×

Python Tutorial

Python Basics

Python I/O

Python Operators

Python Conditions & Controls

Python Functions

Python Strings

Python Modules

Python Lists

Python OOPs

Python Arrays

Python Dictionary

Python Sets

Python Tuples

Python Exception Handling

Python NumPy

Python Pandas

Python File Handling

Python WebSocket

Python GUI Programming

Python Image Processing

Python Miscellaneous

Python Practice

Python Programs

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.

  1. Which of the following correctly creates an empty list in Python?
  2. What is the type of an empty list created using []?
  3. Which function can also be used to create an empty list?

Advertisement
Advertisement

Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2025 www.includehelp.com. All rights reserved.