Last active
August 29, 2015 14:26
-
-
Save wswld/b228e42069fbceb79960 to your computer and use it in GitHub Desktop.
Equating with logical operators in Python
This file contains 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
>>> out = 'bar' or 'foo' | |
>>> out | |
'bar' | |
>>> bar = False | |
>>> out = bar or 'foo' | |
>>> out | |
'foo' | |
>>> bar = None | |
>>> out = bar and 'foo' | |
>>> print out | |
None | |
>>> out = 'foo' and 'bar' and 'tar' | |
>>> out | |
'tar' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment