-
Computing order of Logical statementPython 2019. 7. 24. 00:39
source : https://stackoverflow.com/questions/16069517/python-logical-evaluation-order-in-if-statement
Python - logical evaluation order in "if" statement
In Python we can do this: if True or blah: print("it's ok") # will be executed if blah or True: # will raise a NameError print("it's not ok") class Blah: pass blah = Blah() if blah or
stackoverflow.com
Example)
While condition1 and condition2 :
-> if condition 1 is false, we don't check the condition 2. Just return False.
Example2)
While condition1 or condition2 :
-> if condition1 is true, we don't check the condtion2. Just return True
This is Python.
'Python' 카테고리의 다른 글
[Python3] 파이썬에서의 객체란 (0) 2019.06.04