What does the nonlocal keyword do in Python?
Correct answer
C. Refers to a variable in the nearest enclosing (non-global) scope
9 views
C. Refers to a variable in the nearest enclosing (non-global) scope
9 views
nonlocal lets a nested function rebind a variable of its enclosing function.
Asked in: Python Interview Functions
https://docs.python.org/3/tutorial/controlflow.html#defining-functionsNot sure why the answer is C? Ask here and get an explanation.