Python 101 : Shallow copies - Lists and Tuples -
We have the below data structures:
We also remove "65" from the inner list list1[1] : [25, 65, 12]:
list2[1] points to the same list as list1[1], so when we remove "65" from list1, it is also removed from list2.
We add two values to the inner tuple list1[2] : (5, 3, 4) :
The values are added to list1 but not to list2 since list1[2] and list2[2] points to different tuples
Comments