i did not understand the nonlocal part please elaborate it more clearly
Nonlocal keyword
Local: Defined within a function; only accessible within that function.
Global: Defined outside all functions; accessible throughout the entire program. Can be modified within functions using the global
keyword.
Nonlocal: Defined in an enclosing (but not global) scope; can be modified within nested functions using the nonlocal
keyword.
Basically Non local is defined in nested loops such that the inner loop and the outer loop can use , so it is not exactly local , but it is not global either since it can only be used in the nested loops
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.