Exercise: Flatten a list
Hello, here's my code
def flatten(a_list,z=[]):
for x in a_list:
if isinstance(x,int): z.append(x)
else: flatten(x)
return z
if __name__ == "__main__":
print(flatten([1,2,3]))
when I run this it prints [1,2,3] but when I submit it the error says it gives [1,1,2,3]