Iterate over Items of a Tuple

To iterate over items of a Tuple in Python, use for loop. During each iteration, we get access to an element from Tuple corresponding to that iteration.

Python For Loop

Examples

Iterate over Tuple of Integers

In the following program, we take a tuple x, and iterate over its elements using For Loop.

Python Program

</>
Copy
aTuple = (2, 5, 8)
for x in aTuple:
    print(x)

Output

2
5
8

Conclusion

In this Python Tutorial, we learned how to iterate over items of a Tuple in Python using For Loop.