I'm new to Python , i have the question here. I know the scope thing that whenever a variable is called , python looks into the current scope to see if it exists , if not then go out to the outer scope. Here's my question , i have a global variable x and two local variables as the same name in different functions. But the output shows that one local variable has the same id as the global one. I assume which confused me. If anyone could explain it to me i really appreciate!
x = 10
def variablesTest():
x = 10
print(id(x))
def variablesTest2():
x = 20
print(id(x))
variablesTest()
variablesTest2()
print(id(x))
//output 1643250448 1643250768 1643250448