Python Practice › List Programs › Program 44
Print each element separately
Write a Python program to print each element of a list of tuples separately.
Input
[("Black", "Yellow", "Blue"), (50, 55, 60), (30.0, 50.5, 55.66)]Output
('Black', 'Yellow', 'Blue')
(50, 55, 60)
(30.0, 50.5, 55.66)Approach
- Unpack the list into
print()with*.
Solution
data = [("Black", "Yellow", "Blue"), (50, 55, 60), (30.0, 50.5, 55.66)]print(*data, sep="\n")Output
('Black', 'Yellow', 'Blue')
(50, 55, 60)
(30.0, 50.5, 55.66)Learn the concept
New to this topic? Read the lesson, then come back.