Created
October 5, 2019 03:32
-
-
Save adrianmarkperea/8a6e66a157e07461f838b1373d3fe9c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | |
my_list.append(1) | |
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