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 167 views
2 answers 230 views
1 answer 198 views
1 answer 186 views
1 answer 193 views
1 answer 163 views
...