- Home
- /
- Python Add List Items
Python Tutorial
Introduction
Python Data Types & Oper...
Python Strings
Python Lists
Python Tuples
Python Sets
Python Dictionaries
Conditional Statements
Python Loops
Python Functions
Python Modules
Python OOPS
Advanced Topics
File Handling
- Home
- /
- Python Add List Items
Python Add Items to a List
Once you’ve created a list, Python gives you the power to grow it. Whether you’re adding a single item, placing something at a specific spot, or joining another collection — Python makes it flexible.
Let’s explore the main ways to add items to a list.
append() – Add to the End
This method adds a single item to the end of your list. Think of it as placing another book at the end of a shelf.
colors = ["Pink", "Teal", "Navy"]
colors.append("Cyan")
print(colors)
Output:
['Pink', 'Teal', 'Navy', 'Cyan']
You can keep using append()
to keep stacking more values at the end.
insert() – Add at a Specific Position
What if you want to place an item at a specific index? That’s where insert()
comes in. You tell Python the index and the item, and it fits it in exactly there.
colors = ["Pink", "Teal", "Navy"]
colors.insert(1, "Cyan")
print(colors)
Output:
['Pink', 'Cyan', 'Teal', 'Navy']
This does not overwrite anything. It simply shifts the existing items to the right.
extend() – Merge with Another Collection
Want to combine another list (or tuple, set, or even dictionary)? extend()
is the way.
Example 1: Add one list to another
colors = ["Pink", "Teal"]
extra_colors = ["Orange", "Magenta"]
colors.extend(extra_colors)
print(colors)
Output:
['Pink', 'Teal', 'Orange', 'Magenta']
Slicing: Accessing a Range of Items
You can extract multiple items by slicing the list using:
list[start : end : step]
Note: start
is included, end
is not. Step is optional.
Example 2: Add a tuple
brands = ["Apple", "Samsung"]
more_brands = ("Xiaomi", "Oppo")
brands.extend(more_brands)
print(brands)
Output:
['Apple', 'Samsung', 'Xiaomi', 'Oppo']
Example 3: Add a set
devices = ["Laptop", "Tablet"]
others = {"Smartwatch", "Camera"}
devices.extend(others)
print(devices)
Output:
['Laptop', 'Tablet', 'Camera', 'Smartwatch']
Example 4: Add a dictionary
Only the keys from a dictionary are added.
students = ["Ali", "Sara"]
new_students = {"Ahsan": 20, "Sana": 19}
students.extend(new_students)
print(students)
Output:
['Ali', 'Sara', 'Ahsan', 'Sana']
Using + to Join Lists
You can also use the +
operator to concatenate two lists. This doesn’t modify the originals unless you store the result.
first_half = ["Pink", "Teal"]
second_half = ["Orange", "Red"]
combined = first_half + second_half
print(combined)
Output:
['Pink', 'Teal', 'Orange', 'Red']
Summary
Use
append()
to add one item at the end.Use
insert(index, item)
to add at a specific spot.Use
extend()
to merge another collection.Use
+
when you want to quickly combine two lists.
These methods are your tools to build flexible and dynamic lists in Python.