A shallow copy creates a new object and copies the top-level properties or references, meaning any nested objects or arrays are still shared between the original and the copy.
A deep copy creates a completely independent duplicate of the entire object graph, recursively copying all nested structures so that changes never affect the original.
import copy
old = [[1, 2], [3]]
shallow = copy.copy(old)
deep = copy.deepcopy(old)
old[0].append(99)
print(shallow[0]) # [1, 2, 99]
print(deep[0]) # [1, 2]