Skip to content

Instantly share code, notes, and snippets.

View Flatten.py
#Input Variable
nestedX = [[[[[1, 2, [[[3]]]], 4]]]]
#Recursive function written quickly.
def flatten(nX):
flatX = []
for x in nX:
if isinstance(x,int):
flatX += [x]
else:
You can’t perform that action at this time.