I'm trying to write a code which "flattens" a list, it gets a list which contains several lists of numbers and creates one list of the numbers.
Running examples:
>>> flatten(1) 
[1] 
>>> flatten([]) 
[] 
>>> flatten([[[1],[2,[1]]]]) 
[1, 2, 1] 
I want to do this recursively, but for some reason my code returns the same list:
def flatten(lst):
    if type(lst)==int:
        return [lst]
    elif lst==[]:
        return lst
    else:
        return [flatten(sub) for sub in lst]
 
     
     
     
    