Answers for "ValueError: tuple.index(x): x not in tuple"

0

searching in a tuple python

# vowels tuple
vowels = ('a', 'e', 'i', 'o', 'i', 'u')

# element 'e' is searched
index = vowels.index('e')

# index is printed
print('The index of e:', index)

# element 'i' is searched
index = vowels.index('i')

# only the first index of the element is printed
print('The index of i:', index)
Posted by: Guest on February-25-2020
0

ValueError: tuple.index(x): x not in tuple

ValueError: tuple.index(x): x not in tuple
Posted by: Guest on May-18-2021

Browse Popular Code Answers by Language