a = [[1], [2, 3], [4, 5, 6]]
b = a[:]
a[0] = "x"
a[1][0] = 10
print(a)
print(b)
Why the result is (--why 10 changed the original object?)
['x', [10, 3], [4, 5, 6]]
[[1], [10, 3], [4, 5, 6]]
a = [[1], [2, 3], [4, 5, 6]]
b = a[:]
a[0] = "x"
a[1][0] = 10
print(a)
print(b)
Why the result is (--why 10 changed the original object?)
['x', [10, 3], [4, 5, 6]]
[[1], [10, 3], [4, 5, 6]]