for1.py 359 B

12345678910111213141516171819
  1. # basic for loop
  2. def f():
  3. for x in range(2):
  4. for y in range(2):
  5. for z in range(2):
  6. print(x, y, z)
  7. f()
  8. # range with negative step
  9. for i in range(3, -1, -1):
  10. print(i)
  11. a = -1
  12. # range with non-constant step - we optimize constant steps, so this
  13. # will be executed differently
  14. for i in range(3, -1, a):
  15. print(i)