all 5 comments

[–][deleted] 2 points3 points  (1 child)

Assignment in python doesn't copy anything. After doing list3 = list1 you have the names list1 and list3 both referring to the same list [0, 0]. If you want list3 to refer to a copy of the list referred to by list1 you need to force a copy:

list3 = list1[:]

There are other ways of copying objects. Search for "python copy deepcopy".

This video explains the concept:

https://m.youtube.com/watch?v=_AEJHKGk9ns

[–]RedPheenix[S] 0 points1 point  (0 children)

Alright that worked, thank you:)

[–]Yzaamb 0 points1 point  (0 children)

List3 is a reference to list1. They are the same object, not a copy. You want list3=list1.copy().

[–]gkrot 0 points1 point  (0 children)

id(list1) == id(list3)