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')
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
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')