Skip to content

How to check if a Python list is empty?

Advertisements
l = []
print(l)
print(len(l))
if not l:
 print("list l is empty")

See also  Minimum Absolute Difference in an Array - Hackerrank Challenge - Java Solution

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.