LEGB, global and nonlocal
Interview insights are lockedSee how often this is asked and which companies asked it with Buncho Pro.Explain Python's LEGB rule.
What does this print? Then, how would you modify a global variable from inside a function, and a variable of an enclosing function?
x = 100
def outer():
x = 50
def inner():
x = 10
print(x)
inner()
outer()