index of value in array python code example
Example 1: get index of item in list
list.index(element, start, end)
Example 2: position in array python
a_list = [1, 2, 3]
position_of_three = a_list.index(3)
print(position_of_three)
Example 3: python, list, index function
# vowels list
vowels = ['a', 'e', 'i', 'o', 'i', 'u']
# index of 'e' in vowels
index = vowels.index('e')
print('The index of e:', index)
# element 'i' is searched
# index of the first 'i' is returned
index = vowels.index('i')
print('The index of i:', index)