Python program to Unpack Matrix into One Level List

x = [[1,2,3],[4,5,6],[7,8,9]]
y = [item for row in x for item in row]
print(y)

 

 

 

Output:

[1, 2, 3, 4, 5, 6, 7, 8, 9]

 

Subscribe For Daily Updates

100+ Python Pattern Examplespython pattern examples - star patterns, number patterns