nested function variable scope python code example
Example: python nested functions get variables from function scope
def a():
val = True
def b():
nonlocal val
val = False
def a():
val = True
def b():
nonlocal val
val = False