Guest User

Untitled

a guest
Jun 23rd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. def make_counter(start=0, step=1):
  2. def counter():
  3. return (start+step, make_counter(start=start+step, step=step))
  4. return counter
  5.  
  6. twos = make_counter(start=10, step=2)
  7. curr, twos = twos()
  8. print(curr)
  9. curr, twos = twos()
  10. print(curr)
  11. curr, twos = twos()
  12. print(curr)
  13. curr, twos = twos()
  14. print(curr)
  15. curr, twos = twos()
  16. print(curr)
  17. curr, twos = twos()
  18. print(curr)
Add Comment
Please, Sign In to add comment