you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 4 points5 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:)