How can I create an empty list?



For this exercise, are there any other options for creating an empty list?


There are two ways to create an empty list in Python. The most direct way is to create a variable and assign it an empty list by using a set of square brackets ([]) containing no items. The second way to create an empty list is to use the list class to create an empty list. Both methods achieve the same result and are showing in the following example code.

# Method 1

emptylist1 = []

# Method 2

emtpylist2 = list()