Answers for "how to iterate tuple in python"

0

iterating over tuples in python

thistuple = ("apple", "banana", "cherry")
for x in thistuple:
  print(x)
Posted by: Guest on January-10-2022
0

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])
Posted by: Guest on March-02-2022

Python Answers by Framework

Browse Popular Code Answers by Language