VOOZH about

URL: https://www.geeksforgeeks.org/python/declare-an-empty-list-in-python/

⇱ Declare an Empty List in Python - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Declare an Empty List in Python

Last Updated : 12 Jul, 2025

Declaring an empty list in Python creates a list with no elements, ready to store data dynamically. We can initialize it using [] or list() and later add elements as needed.

Using Square Brackets []

We can create an empty list in Python by just placing the sequence inside the square brackets[]. To declare an empty list just assign a variable with square brackets.


Output
[]
<class 'list'>
0

Explanation:

  • a = []: Initializes an empty list and assigns it to variable a.
  • print(a): Prints the empty list [].
  • print(type(a)): Prints the type of a, which is <class 'list'>, confirming that a is a list.
  • print(len(a)): Prints the length of a, which is 0, since the list is empty.

Using the list() Constructor

list() constructor is used to create a list in Python. It returns an empty list if no parameters are passed.


Output
[]
<class 'list'>
0

Explanation:

  • a = list(): Initializes an empty list using the list() constructor and assigns it to variable a.
  • print(a): Prints the empty list [].
  • print(type(a)): Prints the type of a, which is <class 'list'>, confirming that a is a list.
  • print(len(a)): Prints the length of a, which is 0, since the list is empty.

Related Articles:

Comment