I'm a beginner and I want to write a program that turns:
L=[1,3,[5,[2,6],7],[4,8,[9,10]]]
to:
L=[1,2,3,4,5,6,7,8,9,10]
I wrote this function but I do not know what condition to write to recognize whether it is a list variable or not
def f(n):
a=[]
for i in n :
if i==list :
return f(i)
else:
a.append(i)
return a
If you have a better solution to this problem or you know how to write this condition please help me