I am trying to understand behind the code operation in shallow copy in python
created an object
o = [1,12,32,423,42,3,23,[1,2,3,4]]
created a shallow copy and assigned to a variable
r = copy.copy(o)
print(r)
[1, 12, 32, 423, 42, 3, 23, [1, 2, 3, 4]]
Then tried to assigning new value in two different indexes
o[1]="ff"
o[7][1]="kk"
print(r)
[1, 12, 32, 423, 42, 3, 23, [1, 'kk', 3, 4]]
So as per shallow copy it creates reference of parent in child variable so when we change parent, it reflects in child, but here reference changed only in sublist only. Why so?