- x and y
둘 다 모두 참(True)이어야 참(True)이다.
True and True >> True True and False >> False False and True >> False False and False >> False
- x or y
둘 중 하나만 참이면 참이다.
True or True >> True True or False >> True False or True >> True False or False >> False
- not x
x가 거짓이면 참이다.
not True >> False not False >> True
ex)
not 1 is 1.o # False의 not -> True >> True
1 == 1.0
>> True
1 is 1.0
>> False
주의사항
True 와 true는 엄염히 다른 존재이다. 만약 논리연산자로 사용하고 싶을 경우 대문자 T와 F를 사용해야함
728x90
'Programming > Python' 카테고리의 다른 글
[Python] 문자열 길이 반환 함수 len() (0) | 2024.01.15 |
---|---|
[Python] pip install os (0) | 2024.01.11 |
[Python] turtle input 입력함수, write 사용 (0) | 2024.01.10 |
[Python] 조건문 if? else if? elif? else? (0) | 2024.01.10 |
[Python] 슬라이싱 인덱스 자르기 [1:4] (1) | 2024.01.08 |