Last active
August 29, 2015 14:21
-
-
Save tarunama/1e835546e453622124cd to your computer and use it in GitHub Desktop.
[Python] return A [or / and] B ref: http://qiita.com/tarunama/items/bd51d1a1097bac9b8453
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
def hoge:(self) | |
return A or B |
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
def and_in_return1(): | |
return 1 == 1 and 1 == 1 | |
def and_in_return2(): | |
return 1 == 0 and 1 == 1 | |
def and_in_return3(): | |
return 1 == 1 and 1 == 0 | |
print(and_in_return1()) # True | |
print(and_in_return2()) # False | |
print(and_in_return3()) # False | |
def or_in_return1(): | |
return 1 == 1 or 1 == 1 | |
def or_in_return2(): | |
return 1 == 0 or 1 == 0 | |
def or_in_return3(): | |
return 1 == 1 or 1 == 0 | |
print(or_in_return1()) # True | |
print(or_in_return2()) # False | |
print(or_in_return3()) # True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment