Hi all,
I’m a bit confused about Python's global
and nonlocal
keywords. I understand that global
allows you to modify a variable from the global scope, but I’m not sure how nonlocal
works or when I should use it. Can someone explain the difference between these two and provide examples of when each one is appropriate?
Thanks in advance!