Created
February 24, 2016 04:25
-
-
Save VladSem/fc950136f7d3744c1731 to your computer and use it in GitHub Desktop.
True and False in Python
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
values = [None, 0, "", False, [], {}, "0", True] | |
for v in values: | |
if v: | |
print("True value: {}".format(v)) | |
else: | |
print("False value: {}".format(v)) | |
# False value: None | |
# False value: 0 | |
# False value: | |
# False value: False | |
# False value: [] | |
# False value: {} | |
# True value: 0 | |
# True value: True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment