8.5 심사문제
-
5. 불과 비교, 논리 연산자 알아보기Python/Grammar 2022. 11. 30. 13:03
#1. 불과 비교 연산자 사용하기 1-1. 두 값이 서로 같은지 다른지 판단하기 ==: 두 값이 같으면 True, 두 값이 다르면 False 반환 !=: 두 값이 다르면 True, 두 값이 같으면 False 반환 >>> 1 == 1.0 True 1-2. 두 객체가 서로 같은지 다른지 판단하기 is: 두 객체가 같으면 True, 두 객체가 다르면 False 반환 is not: 두 객체가 다르면 True, 두 객체가 같으면 False 반환 >>> 1 is 1.0 # 1은 정수 객체, 1.0은 실수 객체 False 1-3. 부등호 사용하기 >>> 10 > 1 # 초과 True >>> 10 >> 10 >= 10 # 이상 True >>> 11 >> True and True True >..