Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def alst(L):
- return alst4r([L])
- def alst4r(L):
- head,tail = L[0],L[1:]
- if type(head) != list and tail == []:
- return L
- if type(head) == list:
- return head + [alst4r(head)]
- return alst4r(tail)
- print alst([1,2,3,[4,5,[6,7,[9]]]])
Advertisement
Add Comment
Please, Sign In to add comment