Write a python Program to Flatten and print a List


Topic: Write a python Program to Flatten and print a List

Solution

a=[[1,[[2]],[[[3]]]],[[4],5]]
flatten=lambda l: sum(map(flatten,l),[]) if isinstance(l,list) else [l]
print(flatten(a))



List all Python Programs