Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

tuple

We can iterate over the elements of a tuple. We can also print the whole tuple at once.


planets = ("Mars", "Earth", "Venus")
for planet in planets:
    print(planet)
print(planets)

Output:

Mars
Earth
Venus
('Mars', 'Earth', 'Venus')