Home / Python Tips Generated By ChatGPT / The nonlocal Keyword in Python Modify variables in outer (enclosing) scopes. Source Code def outer(): x = "local" def inner(): nonlocal x x = "nonlocal" inner() print(x) outer()