import copy
spam = [[0, 1, 2, 3], 4, 5]
cheese = cоpy.copy(spam) # shallow copy
cheese.append(3)
cheese[0].append(3)
print(cheese) # [[0, 1, 2, 3, 3], 4, 5, 3]
print(spam) # [[0, 1, 2, 3, 3], 4, 5]
===============================================================
a = [[1,2,3]]
b = a[:] # shallow copy
print(id(a), id(b)) # different ids
b[0][0] = 999
print(a, b) # ANSWER: both will be modified
VS
a = [1,2,3]
b = a[:] # shallow copy
print(id(a), id(b))
b[0] = 999
print(a, b) # ANSWER: a will not be changed
===============================================================
import copy
old_list = [4, 5, 6, [2,3,3]]
new_list = copy.copy(old_list)
new_list[3] = [999]
print(old_list, new_list) # [4, 5, 6, [2, 3, 3]] [4, 5, 6, [999]]
===============================================================
l = [-9, -3, -12, -6, 15, 20]
def c(arr):
arr[0] = "Rustam"
c(l[2:5])
l
# [-9, -3, -12, -6, 15, 20]