fork download
  1. def closure(x):
  2. def inner():
  3. return x
  4. return inner
  5.  
  6. def outer(n):
  7. res = []
  8. for i in range(n):
  9. res.append(closure(i))
  10. return res
  11.  
  12. for f in outer(3):
  13. print(f())
Success #stdin #stdout 0.04s 9588KB
stdin
Standard input is empty
stdout
0
1
2