Welcome to Part 3 of our series: Core Data Structures! So far, we have worked with individual pieces of data stored in variables—a single number, a single string, a single boolean. But what happens when you need to work with a collection of related data, like a to-do list, a roster of players, or a series of temperature readings?
For this, Python gives us its most fundamental and versatile data structure: the list.
In this post, we will introduce the Python list, learn its core properties, and see how to create one.
What is a List?
A list is exactly what it sounds like: a container that holds a collection of items in a specific order. Think of it as a shopping list, a list of high scores, or a numbered to-do list.
In Python, you create a list by placing items inside square brackets []
, separated by commas.
Here are a few examples:
# A list of integers
prime_numbers = [2, 3, 5, 7, 11]
# A list of strings
to_do_items = ["buy groceries", "finish homework", "call mom"]
# You can also create an empty list to add items to later
empty_list = []
print(prime_numbers)
print(to_do_items)
The output will be:
[2, 3, 5, 7, 11]
['buy groceries', 'finish homework', 'call mom']
The Three Key Properties of a List
To truly understand lists, you need to know their three defining characteristics.
1. Lists are Ordered
The items in a list have a defined order, and that order will not change unless you explicitly change it yourself. The first item you put in will always be the first item, the second will be the second, and so on. This means that the list [10, 20, 30]
is different from the list [30, 20, 10]
.
2. Lists Can Hold Any Data Type
Python lists are incredibly flexible. Unlike in some other languages, a single Python list can hold items of different data types all at once.
# This list contains a string, an integer, a float, and a boolean
mixed_list = ["Alice", 25, 99.5, True]
print(mixed_list)
While you can mix types, it’s most common to see lists containing items of the same type (like a list of numbers or a list of strings).
3. Lists are Mutable (Changeable)
This is perhaps the most important property of a list. “Mutable” is a programming term that means changeable. Once you create a list, you are free to modify it. You can add new items, remove existing items, or change the items that are already in it.
This makes lists different from strings, which are immutable. As we know, you can’t change a single character in an existing string; you can only create a new string. With lists, you can modify them “in-place” without having to create a new list. We will learn how to change lists in upcoming posts, but for now, just remember that they are designed to be modified.
What’s Next?
You’ve now met the Python list: an ordered, mutable, and flexible container for holding collections of data. Lists are one of the most-used data structures in Python, and they are the foundation for managing groups of related information.
Now that we know how to create a list and put items in it, how do we get those items back out? How do we access just the first item, or the last item? In Post #47, we will learn how to access individual items in a list using a technique called indexing.
Author

Experienced Cloud & DevOps Engineer with hands-on experience in AWS, GCP, Terraform, Ansible, ELK, Docker, Git, GitLab, Python, PowerShell, Shell, and theoretical knowledge on Azure, Kubernetes & Jenkins. In my free time, I write blogs on ckdbtech.com