1# 2-D List
2matrix = [[1, 2, 3], [4, 5], [6, 7, 8, 9]]
3
4# Nested List Comprehension to flatten a given 2-D matrix
5flatten_matrix = [val for sublist in matrix for val in sublist]
6
7print(flatten_matrix)
1L = [[1, 2, 3],[4, 5, 6],[7, 8, 9]]
2for list in L:
3 for number in list:
4 print(number, end=' ')
5# Prints 1 2 3 4 5 6 7 8 9