Variables in Python are just pointers, as far as I know.
Based on this rule, I can assume that the result for this code snippet:
i = 5
j = i
j = 3
print(i)
would be 3.
But I got an unexpected result for me, and it was 5.
Moreover, my Python book does cover this example:
i = [1,2,3]
j = i
i[0] = 5
print(j)
The result would be [5,2,3].
What am I understanding wrong?
We call them references. They work like this
Small ints are interned, but that isn’t important to this explanation