Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def make_counter():
- count = 0
- def do_count(new_value):
- nonlocal count
- count += new_value
- return count
- return do_count
- counter = make_counter()
- number = counter(1)
- number = counter(5)
- number = counter(10)
- print(number)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement