try to understand how to assign value to a variable from nested function. but it does not work. is it because when I use a = b
, it consider a is local variable for nested function? then how can I assign value to the a variable from func?
def func():
a = 0
def nested(b):
global a
a = b
nested(3)
return a
print(func())