How to find the index of a tuple inside a list in Python

1 Answer

0 votes
lst = ['a', 'c', 'd', 'f', ('v', 'w'), 'g', 'h', 'k']

index = lst.index(('v', 'w'))

print("The index of ('v', w) is: ", index)


'''
run:

The index of ('v', w) is:  4

'''

 



answered Feb 15, 2019 by avibootz
...