Check if a list is empty in Python

Python

Check if a list is empty in Python

#create empty list
a = []

#empty list will return a boolean false
if not a:
print("List is empty")
List is empty
#if we want to check explicitly
if len(a) == 0:
print('List is empty')
List is empty