Python Loop Through a Tuple
Loop Through a Tuple
You can loop through the tuple items by using a for
loop.
Example
Iterate through the items and print the values:
thistuple = ("apple", "banana", "cherry")
for x in thistuple:
print(x)
Try it Yourself »
You can learn more about for
loops in our Python For Loops Chapter.
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.