Problem Statement
In Python name resolution follows which order?
Explanation
Python searches first in the Local scope, then in any Enclosing function scopes, then in the module Global scope, and finally in Builtins.
Knowing LEGB helps explain behaviors with closures, nonlocal, and why a name resolves the way it does.
Code Solution
SolutionRead Only
x='G'
def outer():
x='E'
def inner():
x='L'
return x
return inner()
print(outer())