Source Code:
(back to article)
my_list = [1, 2, 3, 4, 5] # Find the index of 3 in the list for index, element in enumerate(my_list): if element == 3: print(index) break # Output: 2
Result:
Report an issue