Guest User

Untitled

a guest
Feb 12th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. def alst(L):
  2.     return alst4r([L])
  3.  
  4. def alst4r(L):
  5.     head,tail = L[0],L[1:]
  6.     if type(head) != list and tail == []:
  7.         return L
  8.     if type(head) == list:
  9.         return head + [alst4r(head)]
  10.     return alst4r(tail)
  11.        
  12.  
  13. print alst([1,2,3,[4,5,[6,7,[9]]]])
Advertisement
Add Comment
Please, Sign In to add comment