Last modified: May 24, 2026
Python List Insert at End
Adding an item to the end of a Python list is a common task. You have several ways to do it. The best method depends on what you need.
This guide shows you the most practical techniques. You will learn about append(), insert(), and extend(). Each method has its own use case.
Using append() to Insert at End
The append() method is the simplest way. It adds a single item to the end of a list. This method modifies the original list in place.
It takes one argument. That argument can be any data type. This includes numbers, strings, or even another list.
# Example of append()
fruits = ["apple", "banana"]
fruits.append("cherry")
print(fruits) # Output: ['apple', 'banana', 'cherry']
['apple', 'banana', 'cherry']
Important:append() adds the entire object as one element. If you append a list, it becomes a nested list.
# Appending a list as a single element
numbers = [1, 2]
numbers.append([3, 4])
print(numbers) # Output: [1, 2, [3, 4]]
[1, 2, [3, 4]]
Using insert() with len()
The insert() method can also add an item at the end. You need to specify the index. Use len() to get the last position.
This method takes two arguments. The first is the index. The second is the item to insert.
# Using insert() at the end
colors = ["red", "green", "blue"]
colors.insert(len(colors), "yellow")
print(colors) # Output: ['red', 'green', 'blue', 'yellow']
['red', 'green', 'blue', 'yellow']
This works well. But append() is more readable for this task. Use insert() when you need to add an item at a specific position, not just the end.
For more on inserting at other positions, read our Python List Insert at Beginning guide.
Using extend() to Add Multiple Items
If you want to add multiple items at once, use extend(). It takes an iterable as an argument. It adds each element from that iterable to the end of the list.
This method is great for merging lists. It does not create a nested list. It flattens the iterable into the original list.
# Using extend() to add multiple items
list_a = [1, 2, 3]
list_b = [4, 5, 6]
list_a.extend(list_b)
print(list_a) # Output: [1, 2, 3, 4, 5, 6]
[1, 2, 3, 4, 5, 6]
Note:extend() modifies the original list. It does not return a new list. This is different from concatenation with the + operator.
# Difference between extend() and +
original = [1, 2]
new_list = original + [3, 4] # Creates a new list
print(original) # Output: [1, 2]
print(new_list) # Output: [1, 2, 3, 4]
original.extend([5, 6]) # Modifies original
print(original) # Output: [1, 2, 5, 6]
[1, 2]
[1, 2, 3, 4]
[1, 2, 5, 6]
For more details on adding multiple items, see our Python List Insert Multiple Items article.
Performance Comparison
When inserting at the end, append() is the fastest. It has a time complexity of O(1). This means it takes constant time, regardless of list size.
The insert() method with len() is also O(1) at the end. But it requires an extra function call. This makes it slightly slower than append().
The extend() method is O(k), where k is the number of items added. It is efficient for adding many items at once.
For a deeper look at performance, check our Python List Insert Time Complexity guide.
Common Mistakes to Avoid
Beginners often confuse append() and extend(). Remember that append() adds one object. extend() adds each element from an iterable.
Another mistake is using insert() with a negative index. A negative index like -1 inserts before the last element, not at the end.
# Negative index inserts before the last element
items = [10, 20, 30]
items.insert(-1, 25)
print(items) # Output: [10, 20, 25, 30] - not at the end!
[10, 20, 25, 30]
To avoid this, always use len(list) or simply use append().
Practical Examples
Here are some real-world use cases. These examples show when to use each method.
Example 1: Building a Log
You want to add log entries to a list. Use append() for each new entry.
# Building a log list
log = []
log.append("Start process")
log.append("Step 1 complete")
log.append("Error occurred")
print(log)
['Start process', 'Step 1 complete', 'Error occurred']
Example 2: Merging User Lists
You have two lists of users. Use extend() to combine them.
# Merging user lists
admins = ["Alice", "Bob"]
users = ["Charlie", "Diana"]
admins.extend(users)
print(admins) # Output: ['Alice', 'Bob', 'Charlie', 'Diana']
['Alice', 'Bob', 'Charlie', 'Diana']
Example 3: Conditional Insertion
Sometimes you need to add an item only if a condition is met. Use append() inside an if statement.
# Conditional insertion
scores = [85, 90, 78]
new_score = 92
if new_score > 80:
scores.append(new_score)
print(scores) # Output: [85, 90, 78, 92]
[85, 90, 78, 92]
Conclusion
Inserting at the end of a Python list is easy. Use append() for a single item. Use extend() for multiple items. Use insert() with len() only when you need more control.
Each method has its place. Choose the one that makes your code clear and efficient. Practice with these examples to build confidence.
For a complete reference, read our Python List Insert: Complete Guide.