Python Practice › List Programs › Program 44

Print each element separately

EasyList Programs · 44 of 100

Write a Python program to print each element of a list of tuples separately.

Advertisement
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

  1. Unpack the list into print() with *.

Solution

Python
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.

More list programs

← All 100 List Programs

Leave a Comment