Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to iterate tuple in python

#Loop Through the Index Numbers

#You can also loop through the tuple items by referring to their index number.

#Use the range() and len() functions to create a suitable iterable.

#Print all items by referring to their index number:

thistuple = ("apple", "banana", "cherry")
for i in range(len(thistuple)):
  print(thistuple[i])
Source by liu-111.medium.com #
 
PREVIOUS NEXT
Tagged: #iterate #tuple #python
ADD COMMENT
Topic
Name
5+3 =