Why does this function have a different value for the same variable but the same address? : <pre><code>def func(t):
    t = 5
    print('inside function', t)
    print('inside function address = ', id(hex(t)))

x = 3
func(x)
print('outside function',x)
print('outside function address = ', id(hex(x)))
</code></pre>

<p>This Prints</p>

<pre><code>inside function 5
inside function address =  31255648
outside function 3
outside function address =  31255648
</code></pre>

<p>My understanding was a variable referenced in a function without assignment will use a variable outside of its scope. But if the function has an assignment, then it will create a new variable in a new space in memory and assign it there.</p>

<p>Why does the function id find the original address of the argument instead of the address of the newly created variable? </p>
