4 ms·
#python code def flat(x): if type(x) == type([]) and len(x)==1: return flat(x[0]) if type(x) == type([]) and len(x)>1: return flat(x[0]) + flat
by linkedlist007 10y ago
#python code
def flat(x):
if type(x) == type([]) and len(x)==1:
return flat(x[0])
if type(x) == type([]) and len(x)>1:
return flat(x[0]) + flat(x[1:])
else:
return [x]