Variable stores reference:
a = [3, 4]
list1 = [1, 2, a]
list1[2][0]=5
print(list1)
print(a)
output:
[1, 2, [5, 4]]
[5, 4]
Variable stores value:
a = 3
list1 = [1, 2, a]
list1[2]=5
print(list1)
print(a)
output:
[1, 2, 5]
3
Is there a rule I can remember? Cause sometimes I have to manipulate the variable indirectly and I don't know if it'll change the original or not.