Jan-04-2022, 04:21 PM
Here's a nested function:
Why is this? In the latter case, inner() should return n (2) and inner() is called in the outer function.
def outer():
n = 1
def inner():
n = 2
print(n)
#return n
inner()
return nIf I type outer(), then I get 2 and 1 on separate lines. If I comment out Line 6 instead of 7, then I only get 1 as a single line of output. Why is this? In the latter case, inner() should return n (2) and inner() is called in the outer function.
