Python Reference
list.append()
Add a single item to the end of a list. Mutates in place, returns None.
Last updated: October 2026
append() adds one item to the end of a list. It mutates the list in place and returns None — never assign the result.
Full definition: list.append(x) adds a single item x to the end of a list. It modifies the list in place and returns None. It always adds exactly one element.
🎬 Live Example
Five common append patterns. Click any button to see the output.
💡 append always adds exactly one element — even if that element is a list.
Basic Syntax
list.append(x)
# x — any object
# Mutates list in place
# Returns None
# Adds exactly ONE element (even if x is a list)
🎯 Parameters & Return
| Item | Type | Description |
|---|---|---|
x | any | The single item to add to the end. |
| Return | None | Always None — mutates the list in place. |
Basic Usage
fruits = ["apple", "banana"]
fruits.append("cherry")
# fruits: ["apple", "banana", "cherry"]
nums = [1, 2, 3]
nums.append(4)
# nums: [1, 2, 3, 4]
Return Value Trap
nums = [1, 2]
# ❌ WRONG
nums = nums.append(3)
# nums is now None!
# ✅ CORRECT
nums.append(3)
# nums: [1, 2, 3]
Common bug: Never assign the result of append. It always returns None.
append vs extend
a = [1, 2]
a.append([3, 4])
# [1, 2, [3, 4]] ← nested
b = [1, 2]
b.extend([3, 4])
# [1, 2, 3, 4] ← flattened
Rule of thumb: append = "add this thing." extend = "add all items from this iterable."
Building a List in a Loop
squares = []
for i in range(5):
squares.append(i ** 2)
# [0, 1, 4, 9, 16]
# Pythonic alternative:
squares = [i ** 2 for i in range(5)]
Real-World: Collecting API Results
users = []
for page in range(1, 4):
response = fetch_users(page)
for user in response:
users.append(user)
# All users across pages now in one list
🎯 append vs extend vs insert vs +
| Method | Adds | Complexity |
|---|---|---|
append | 1 item at end | O(1) |
extend | Many items at end | O(k) where k = len(iterable) |
insert | 1 item at index | O(n) |
+ | Concatenated list | O(n + m), creates new list |
⚠️ Common Mistakes
- Assigning the return value.
my_list = my_list.append(x)sets to None. - Expecting append to flatten. It adds the argument as one item. Use extend.
- Using append for many items. Call extend or use
+=. - Appending in a list comprehension. Comprehensions don't append — they build new lists.
- Using append to insert. Use
insert(index, x)for specific positions.
❓ Frequently Asked Questions
What does append() do in Python?
list.append(x) adds a single item to the end of a list. It modifies the list in place and returns None.
What is the difference between append and extend?
append adds its argument as a single element. extend iterates over its argument and adds each element individually. append([1,2]) adds one nested list; extend([1,2]) adds two items.
What is the difference between append and insert?
append always adds to the end. insert adds at a specific index. append is O(1); insert is O(n) because it shifts elements.
Does append return the list?
No. append returns None. It mutates the list in place. Writing my_list = my_list.append(x) will set my_list to None.
Can append add multiple items at once?
No. append takes exactly one argument. Use extend to add multiple items, or call append multiple times.