I encountered a situation that confused me about global and local scopes.
x = 25
def display(a, b=x):
print(a, b)
x = 15
Output:
>>> display(3)
3 25
How is the output is 3 25 and not 3 15?
I encountered a situation that confused me about global and local scopes.
x = 25
def display(a, b=x):
print(a, b)
x = 15
Output:
>>> display(3)
3 25
How is the output is 3 25 and not 3 15?