def flat_list(n,l=[]): for i in n: l.append(i) if not type(i)==list else l+flat_list(i) return l
my code works but in wont pass the test