Skip to content

Instantly share code, notes, and snippets.

@tarunama
Last active August 29, 2015 14:21
Show Gist options
  • Save tarunama/1e835546e453622124cd to your computer and use it in GitHub Desktop.
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
def hoge:(self)
return A or B
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