Write a Python program to flatten a shallow list


Topic: Write a Python program to flatten a shallow list

Solution

import itertools
original_list = [[2,4,3],[1,5,6], [9], [7,9,0], [1,2,3,4]]
new_merged_list = list(itertools.chain(*original_list))
print(f'merged list/flatten:{new_merged_list}')



List all Python Programs