a = [10, 23, 56, [78]]
b = list(a)
a[3][0] = 95
a[1] = 42
print(b)
So, I am printing b
here, not a
. While getting an output only the nested list part seems to be changed in b
while everything else remains unchanged:
a is now [10, 42, 56, [95]] # [95] was changed in a and b, but 23 b is now [10, 23, 56, [95]] # did not change to 42 in b - only in a
Can someone please explain me what's happening?