How to Add an Item to the End of a List in Python with append
A list often grows while a program runs: one more item in a basket, one more word in a sentence, one more result in a table. append adds one item to the end of a list, and the list keeps everything it already had. This guide does it on Python 3.15.2.
Syntax
<list>.append(<item>)
| Part | What it means |
|---|---|
<list> | The list to add to. append changes this list itself |
.append(...) | Adds one item after the last one |
<item> | The value to add: a string, a number or anything else |
The Python tutorial describes list.append in one line: "Add an item to the end of the list."
The Example
A shopping basket starts with milk and bread. The script adds eggs, then prints the basket and how many items it holds.
Prerequisites
- uv and Python 3. This guide uses uv 0.13.10 with Python 3.15.2, in a project made with
uv init.
Step 1: Write the Script
basket = ["milk", "bread"]
basket.append("eggs")
print(basket)
print(len(basket))

The append line stands on its own. There's no basket = in front of it, because append changes the list that basket already names.
Step 2: Run It
uv run python basket.py
['milk', 'bread', 'eggs']
3

eggs is now the last item, after milk and bread, and the list holds three items instead of two. The command works unchanged in PowerShell.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
Saving the result: basket = basket.append("eggs") | append returns None, so basket became None and the list was lost. The next basket.append("jam") raised AttributeError: 'NoneType' object has no attribute 'append' | Write basket.append("eggs") on a line of its own |
| Appending a list to add several items | basket.append(["tea", "jam"]) gave ['milk', 'bread', ['tea', 'jam']]: the whole list went in as one item, and len(basket) was 3 | Use extend: basket.extend(["tea", "jam"]) gave ['milk', 'bread', 'tea', 'jam'] |
| Passing two items | basket.append("tea", "jam") raised TypeError: list.append() takes exactly one argument (2 given) | Call append once per item, or use extend with a list |
FAQ
How do I add an item at the start instead?
Use insert with the position 0. basket.insert(0, "apples") gave ['apples', 'milk', 'bread']. The tutorial says a.insert(0, x) "inserts at the front of the list".
Can I append to an empty list?
Yes. Starting from basket = [], two calls of basket.append("milk") gave ['milk', 'milk']. That also shows a list can hold the same item twice.
How is append different from joining lists with +?
basket + ["eggs"] builds a new list and leaves basket as it was: the new list was ['milk', 'bread', 'eggs'], and basket still held ['milk', 'bread']. append changes basket itself and builds nothing new.
Does append work on a tuple?
No. A tuple can't be changed after it's made. With basket = ("milk", "bread"), the call basket.append("eggs") raised AttributeError: 'tuple' object has no attribute 'append'.
Conclusion
basket.append("eggs") added eggs after the last item and changed basket itself, which then held ['milk', 'bread', 'eggs']. It returns None, so it belongs on a line of its own.
Additional Resources
- More on Lists —
append,extend,insertand the other list methods. - Mutable sequence types — every operation that changes a list.
