thistuple = ("apple", "banana", "cherry")
for x in thistuple:
print(x)
t=(1,2,3)
for i in t:
print i
myTuple = (1, 2, 3)
for x in myTuple:
print(x)
"""
Output:
1
2
3
"""
# Using a for loop to iterate through a tuple
for name in ('John', 'Kate'):
print("Hello", name)
#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])