1def flatten_list(_2d_list):
2 flat_list = []
3 # Iterate through the outer list
4 for element in _2d_list:
5 if type(element) is list:
6 # If the element is of type list, iterate through the sublist
7 for item in element:
8 flat_list.append(item)
9 else:
10 flat_list.append(element)
11 return flat_list
12
13nested_list = [[1, 2, 3, 4], [5, 6, 7], [8, 9, 10]]
14print('Original List', nested_list)
15print('Transformed Flat List', flatten_list(nested_list))
16