1my_list = list()
2# Check if a list is empty by its length
3if len(my_list) == 0:
4 pass # the list is empty
5# Check if a list is empty by direct comparison (only works for lists)
6if my_list == []:
7 pass # the list is empty
8# Check if a list is empty by its type flexibility **preferred method**
9if not my_list:
10 pass # the list is empty
1# declare list
2a = []
3
4print("Values of a:", a)
5print("Type of a: ", type(a))
6print("Size of a: ", len(a))
7
8# Output:
9# > Values of a: []
10# > Type of a: <class 'list'>
11# > Size of a: 0