Answers for "find index of element in python"

2

python get element by index

# To return the index of the first occurence of element x in lst
ind = lst.index(x)
Posted by: Guest on March-26-2020
0

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)
Posted by: Guest on September-28-2020

Code answers related to "find index of element in python"

Python Answers by Framework

Browse Popular Code Answers by Language