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 | B | A OR B |
True | True | True |
True | False | True |
False | True | True |
False | False | False |
3) Not
A | Not A |
True | False |
False | True |
'Tech-Pyhton' 카테고리의 다른 글
MIT OCW - Introduction to Computer Science and Programming in Python - Lecture 02 (0) | 2019.01.09 |
---|---|
MIT OCW - Introduction to Computer Science and Programming in Python - Lecture 01 (0) | 2018.12.30 |
Python print에서 Single Quotation과 Double Quotation (0) | 2018.12.13 |
Code Academy - Learn Python : STRINGS & CONSOLE OUTPUT (0) | 2017.09.06 |
Code Academy - Learn Python : Python Syntax (0) | 2017.09.03 |
댓글