본문 바로가기
Python 배우기

비교 연산자 comparison_operators.py

by 노화방지 Anti-aging Hairstyle 2016. 3. 6.
반응형

one = 1
two = 2
three = 3

print(one < two < three) # 이 chained comparison는 (one < two)과 (two < three) 비교가 동시에 수행됨을 의미합니다.

is_greater = three > two
print(is_greater)


산출물 (Output)
True

True



* Python은 &gt;=, &lt;=, &gt;, &lt; 등의 많은 비교 연산자 타입을 갖고 있습니다. 파이썬 내의 모든 비교 연산자는 동일한 priority를 갖고 있습니다. Comparisons은 boolean 값(True 또는 False)를 yield 합니다. Comparisons은 임의로 chain 될 수 있습니다.


반응형

'Python 배우기' 카테고리의 다른 글

string_multiplication.py  (0) 2016.03.06
concatenation.py  (0) 2016.03.06
boolean_operators.py  (0) 2016.03.06
할당 assignments.py  (0) 2016.03.06
연산자 arithmetic_operators.py  (0) 2016.03.06

댓글