fork download
  1. def foo(step=0, level=0):
  2. for i in range(step, 4):
  3. print ' ' * (level * 4), step
  4. foo(step+1, level+1)
  5.  
  6. foo()
Success #stdin #stdout 0.01s 7852KB
stdin
Standard input is empty
stdout
 0
     1
         2
             3
         2
             3
     1
         2
             3
         2
             3
     1
         2
             3
         2
             3
 0
     1
         2
             3
         2
             3
     1
         2
             3
         2
             3
     1
         2
             3
         2
             3
 0
     1
         2
             3
         2
             3
     1
         2
             3
         2
             3
     1
         2
             3
         2
             3
 0
     1
         2
             3
         2
             3
     1
         2
             3
         2
             3
     1
         2
             3
         2
             3