Local -> Enclosed -> Global
where the arrows should denote the direction of the namespace-hierarchy search order.
Local can be inside a function or class method
Enclosed can be its enclosing function, e.g., if a function is wrapped inside another function.
Global refers to the uppermost level of the executing script itself
So, if a particular name cannot be found in the local namespaces, the namespaces of the enclosed scope are being searched next. If the search in the enclosed scope is unsuccessful, too, Python moves on to the global namespace
but when we try to change the outer variable from inner function it creates a local copy of that variable