본문 바로가기
Tech-Pyhton

Code Academy - Learn Python : CONDITIONALS & CONTROL FLOW

by redcrow 2018. 6. 9.


1. if - elif - else : 


if input == "a"  or input == "b" :

print "input is a or b"

elif input == "c"  : 

print "input is c"

else:

print "input is else"


2. Comparator


(20 - 10) > 15         # False

(10 + 17) == 3**16  # Fasle

1**2 <= -1             # False

40 * 4 >= -4           # True

100 != 10**2           # True



3. Boolean Operator


1) AND


A

B

A AND B

 True

 True

 True

 True

 False

 False

 False

 True

 False

 False

 False

 False


2) OR


A OR B

 True

 True

 True

 True

 False

 True

 False

 True

 True

 False

 False

 False



3) Not


Not A

 True

 False

 False

 True


댓글