Hello. I’m playing around with code to understand the concept of scope.
Why does the following not return 101 when I’m calling the function?
def enclosing(x):
number = x
#Adds 1 to number
def add_one():
nonlocal number
number + 1
#Call to add 1 to number
add_one()
return number
print(enclosing(100))