How to Find position (index) of element in a tuple with Python

1 Answer

0 votes
tpl = ('a', 'b', 'c', 'd', 'e', 'f', 'g')

index = tpl.index('a')
print(index)

index = tpl.index('g')
print(index)
  
  
'''
run:
  
0
6
  
'''

 



answered Dec 24, 2019 by avibootz

Related questions

1 answer 172 views
2 answers 239 views
1 answer 208 views
1 answer 195 views
1 answer 205 views
1 answer 171 views
...