Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def multiplier(f):
- def times(n):
- # is f local?
- nonlocal f
- f=f+1
- # if not, why is it here?
- print("Locals: ",locals())
- return n*f
- return times
- times2 = multiplier(2)
- print(times2(4)) # 3X4=12
- print(times2(4)) # 4X4=16
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement