fork download
  1. def foo(x):
  2. if not x:
  3. return []
  4. else:
  5. return [x[-1]] + foo(x[0:-1])
  6.  
  7. print foo([1,2,3,4])
Success #stdin #stdout 0.02s 4676KB
stdin
Standard input is empty
stdout
[4, 3, 2, 1]