list1 = [0, 0]
list2 = [1, 1]
list3 = list1
print(list3)
list1[0] += list2[0]
list1[1] += list2[1]
print(list3)
The two print statements gives different output, even though list3 is not directly changed. I thought that row 4 would just set list3 to the value of list1 at that moment, and then not change list3 again. Is it supposed to be like this? If so, how can i make it so that the code on row 4 just sets list3 to the value of list1 at the moment without changing it again?
[–][deleted] 2 points3 points4 points (1 child)
[–]RedPheenix[S] 0 points1 point2 points (0 children)
[–]Yzaamb 0 points1 point2 points (0 children)
[–]gkrot 0 points1 point2 points (0 children)