def raise_val(n):
def inner(x):
raised = x**n
return raised
return inner
square = raise_val(2)
print(square(2))# gives 4 as output
I don't understand how this nested function works...also why does square(2)
output 4?
Isn't square
just a variable?