Lists, copying and mutation
Learn in depth →A list is an ordered mutable collection. A shallow copy creates a new outer container.
items.append(value); items.extend(values); items.copy()Example
a = [[1]]
b = a.copy()
b[0].append(2)
print(a, b)
print(a.append([3]))Result
[[1, 2]] [[1, 2]] None
Watch for: append and sort mutate in place and return None. Shallow copies still share nested objects.
Practise this topic →