Answers for "index of a value python"

43

python find index by value

>>> ["foo", "bar", "baz"].index("bar")
1
Posted by: Guest on November-19-2019
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 "index of a value python"

Python Answers by Framework

Browse Popular Code Answers by Language