Python Practice › Tuple Programs › Program 46
List of tuples to list of lists
Write a Python program to convert a list of tuples into a list of lists.
Input
[(1, 5), (7, 8), (4, 0)]
Output
[[1, 5], [7, 8], [4, 0]]
Approach
list(t)for each tuple.
Solution
print([list(t) for t in [(1, 5), (7, 8), (4, 0)]])Output
[[1, 5], [7, 8], [4, 0]]
Learn the concept
New to this topic? Read the lesson, then come back.