Why the following code doesn't work as it is but would work after commenting either print(x)
or x=1
?
def f():
x = 1
def g():
print(x)
x = 1
g()
f()
Why the following code doesn't work as it is but would work after commenting either print(x)
or x=1
?
def f():
x = 1
def g():
print(x)
x = 1
g()
f()