Home »
Python
Python - Create an Empty List
Last Updated : May 01, 2025
In Python, creating an empty list is a basic need when you want to store a collection of items that will be added later during program execution. An empty list can be created either using a pair of square brackets []
with no elements inside or using the list()
constructor.
Creating an Empty List Using Square Brackets
You can create an empty list in Python using a pair of square brackets []
. This is the most common and straightforward way to initialize an empty list.
Example
In this example, we are creating an empty list using square brackets.
# Creating an empty list
# using square brackets
my_list = []
# Display the empty list
print("Empty list:", my_list)
The output of the above code would be:
Empty list: []
Creating an Empty List Using the list() Constructor
Another way to create an empty list is by using the built-in list()
function without passing any element.
Example
In this example, we are creating an empty list using the list()
constructor.
# Creating an empty list using
# the list() function
my_list = list()
# Display the empty list
print("Empty list:", my_list)
The output of the above code would be:
Empty list: []
Exercise
Select the correct option to complete each statement about creating and using empty lists in Python.
- Which of the following correctly creates an empty list in Python?
- What is the type of an empty list created using
[]
?
- Which function can also be used to create an empty list?
Advertisement
Advertisement