Check if a List is Empty or Not in Python Using len() Function

(Last Updated On: 27/01/2023)

Python Program to Check if a List is Empty or Not Using len() Function

# Check If a List is Empty in python Using len() function

# empty list
list = []

# Checking whether the list size is equal to 0
if len(list) == 0:
   print('Empty list')
else:
   print('Not Empty list')

Output:

Empty list

Leave a Reply

Your email address will not be published. Required fields are marked *