Both grow a list in place, but they treat the argument differently.
append(x)
- Adds
xas a single element at the end. - Length increases by 1.
extend(iterable)
- Iterates over
iterableand adds each item. - Length increases by the number of items yielded.
a = [1, 2]
a.append([3, 4])
print(a) # [1, 2, [3, 4]] ← nested list
b = [1, 2]
b.extend([3, 4])
print(b) # [1, 2, 3, 4] ← flattened addition
c = [1, 2]
c.extend("ab")
print(c) # [1, 2, 'a', 'b'] strings are iterable
# + creates a new list; append/extend mutate
d = [1, 2] + [3, 4] # new objectInterview tip: If someone says "append multiple values," clarify whether they mean one nested object (append) or many elements (extend / +=).