If you need to add elements to an empty list in Python, call cart.append(item) to add one element, or cart.extend([...]) to add several at once. Both change the list in place.
Where people get stuck is the small stuff: append() with a list nests it, and assigning the result of append() gives you None.
In this article, I’ll show you the four ways I add elements to an empty list, plus the traps. I ran every snippet on Python 3.12.5.
The empty list we’ll fill
I’ll use a shopping cart for an online desk-setup store. It starts as cart = [], the empty-brackets form from creating an empty list in Python, and the items are:
- Standing desk
- Monitor arm
- USB-C hub
Method 1: Add elements to an empty list in a for loop with append() (Recommended)
append() adds exactly one element to the end of the list.
cart = []
for item in ["Standing desk", "Monitor arm", "USB-C hub"]:
cart.append(item)
print(cart, len(cart))
Output:
['Standing desk', 'Monitor arm', 'USB-C hub'] 3

How does this code work?
The cart starts empty, so its length is 0. Each pass through the loop calls append() with the next item.
For more on looping, see looping through a list in Python.
Method 2: Add several elements with extend()
When you already have a batch of items, extend() adds each one separately. For more on this, see extend vs append in Python.
cart = []
cart.extend(["Standing desk", "Monitor arm"])
print(cart)
wrong = []
wrong.append(["Standing desk", "Monitor arm"])
print(wrong, len(wrong))
Output:
['Standing desk', 'Monitor arm']
[['Standing desk', 'Monitor arm']] 1

How does this code work?
extend() loops over the list you give it and adds every item. So the cart gets two separate strings.
append() treats the whole list as one object, which is why the second list has a length of 1. To add many values quickly, appending multiple items to a list covers more patterns.
Method 3: Add an element at a position with insert()
insert(index, item) puts an element at a specific position. On an empty list, only one position really exists.
cart = []
cart.insert(0, "USB-C hub")
cart.insert(0, "Monitor arm")
cart.insert(5, "Standing desk")
print(cart)
Output:
['Monitor arm', 'USB-C hub', 'Standing desk']

How does this code work?
Index 5 doesn’t exist yet, so Python doesn’t raise an error; it just adds the standing desk at the end. For front-of-list work, see adding an element to the beginning of a list.
Method 4: Add elements in a for loop with a condition or range()
The same append() loop can filter values or build them from range(). A comprehension does the second job in one line.
prices = [120.00, 80.00, 200.00, 50.00, 300.00]
premium = []
for price in prices:
if price > 100:
premium.append(price)
print(premium)
squares = []
for n in range(1, 6):
squares.append(n * n)
print(squares)
print([n * n for n in range(1, 6)])
Output:
[120.0, 200.0, 300.0]
[1, 4, 9, 16, 25]
[1, 4, 9, 16, 25]

How does this code work?
The if test decides which prices get appended. range(1, 6) yields 1 to 5, and the comprehension is the shorter form of the same loop.
Why does my list turn into None after append()?
This one catches almost everyone once. append() changes the list and returns None, so assigning its result throws your list away.
cart = []
cart = cart.append("Standing desk")
print(cart)
try:
cart.append("Monitor arm")
except AttributeError as err:
print("AttributeError:", err)
Output:
None
AttributeError: 'NoneType' object has no attribute 'append'

Just call cart.append(item) on its own line.
Things to Keep in Mind When Adding Elements
append()adds one object. Pass it a list and you get a nested list; useextend()instead.- Don’t assign the result of
append(). It returnsNone; call it on its own line. - To avoid repeats, see removing duplicates from a list.
A few more list guides worth reading next:
Frequently asked questions
How do I add elements to an empty list in Python?
Create it with [], then call append() for one item or extend() for several.
What is the difference between append() and extend()?
append() adds its argument as one element. extend() adds each item of an iterable separately.
Why does my list become None after append()?
append() returns None. Don’t assign it back; just call it on the list.
Can I use insert() on an empty list?
Yes. Any index works; on an empty list the item simply becomes the first element.
Where are list methods documented?
See More on Lists in the Python docs.

Bijay Kumar is a 13-time Microsoft MVP with more than 18 years in software development, and the founder of Python Guides and TSinfo Technologies. He started out building .NET and SharePoint solutions at HP, TCS and KPIT before moving into Python, machine learning and AI, and he also builds web apps with TypeScript and React. He writes the tutorials here himself, and every example is run before publishing so you see the real output. More about Bijay · Microsoft MVP profile · LinkedIn