input: list of [integers, lists of integers, lists of lists of integers ad infinitum] output: list of [integers]
heres my initial solution:
x = [[1, 2], 1, [1], [2, 1, [1, 2]]]
numb = []
for l in x:
if type(l) is int:
numb.append(l)
else:
for l2 in l:
if type(l2) is int:
numb.append(l2)
else:
for l3 in l2:
numb.append(l3)
print(numb)
however this solution is only good up to three embedded lists...
i wonder if there is a way of dealing with possibly infinite embedded lists....
i.e. is there a way of coding this solution without n nested for loops for n embedded lists