t545.py 185 B

12345678910111213141516
  1. from time import sleep;
  2. def sleepFiveTimes(param):
  3. v = 0
  4. for i in range(5):
  5. sleep(0.01)
  6. yield v
  7. v += param
  8. gen = sleepFiveTimes(5);
  9. print gen.next()
  10. for v in gen:
  11. print v