Python Practice › List Programs › Program 91
Tuples to sublists
Write a Python program to convert the tuples in a list into lists.
Input
[(3, 5), (6, 8), (8, 11), (12, 14), (17, 23)]
Output
[[3, 5], [6, 8], [8, 11], [12, 14], [17, 23]]
Approach
list(t)for each tuple.
Solution
data = [(3, 5), (6, 8), (8, 11), (12, 14), (17, 23)]print([list(t) for t in data])Output
[[3, 5], [6, 8], [8, 11], [12, 14], [17, 23]]
Learn the concept
New to this topic? Read the lesson, then come back.