프로그래밍/Python

Python 공부 2일차(5장)

은바재바 2021. 6. 1. 00:10

불 타입


불 연산자

- 기초 불 연산자는 not, and, or 3개로 not부터 차례로 우선순위가 높음

- ' ' 빈 문자열은 False고 그 외 모든 문자열은 True로 간주

not                                                                                     
>>> not True                  
# False
>>> not False 
# True

and
>>> True and True 		
# True
>>> False and False
# False
>>> True and False
# False
>>> False and True
# False

or
>>> True or True
# True
>>> False or False
# False
>>> True or False
# True
>>> False or True
# True