This is the challenge:
x = 11
def foo1():
x = 2
class foo:
print(x)
foo1() # prints 2
x = 11
def foo2():
x = 2
class foo:
print(x)
x += 1
foo2() # prints 11
What is the explanation of this behaviour? Anyone?
This is the challenge:
x = 11
def foo1():
x = 2
class foo:
print(x)
foo1() # prints 2
x = 11
def foo2():
x = 2
class foo:
print(x)
x += 1
foo2() # prints 11
What is the explanation of this behaviour? Anyone?