Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
my_list = []
if not my_list:
print('List is empty')
# This could also work, but is unnecessary
if len(my_list) == 0:
print('List is empty')
if my_list:
print('List is not empty')
# outputs:
List is empty
List is empty
List is not empty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment