I am using Python 3. Suppose I have 2 variables and create a list containing the 2 variables
a = 48
b = 42
arr = [a, b]
If I modify a
then arr
remains the same, this is because a
is an integer, if it was an object, then the object in arr
(that is technically a reference to the same object) gets updated. I want arr[0]
to be a reference to the variable a
rather than the value itself, so that if a
is changed then arr[0]
is changed as well. How do I do that?