Difference Between Global And Nonlocal
Mon 10 August 2026
x = 50
def outer():
x = 10
def inner():
global x
x = 99
inner()
print("Outer x:", x)
outer()
print("Global x:", x)
Outer x: 10
Global x: 99
Score: 10
Category: chapter13_global_and_scope