ValueError: tuple.index(x): x not in tuple code example
Example 1: 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)
Example 2: ValueError: tuple.index(x): x not in tuple
ValueError: tuple.index(x): x not in tuple