Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- Pipelining
- mysql
- DATAPATH
- html
- MacOS
- function
- system
- python
- php
- react
- XML
- Java
- github
- web
- architecture
- CSS
- computer
- DoM
- DS
- instruction
- data structure
- for
- control
- Class
- javascript
- MIPS
- Algorithm
- while
- Linux
- DB
Archives
- Today
- Total
YYYEJI
[Python] AND, OR 연산하기 본문
728x90
AND
AND는 두 개의 조건이 있을 때 두 조건이 모두 참이여야지만 True입니다.
Condition 1 | Condition 2 | Result |
False | Flase | False |
True | False | False |
False | True | False |
True | True | True |
OR
OR은 두 개의 조건이 있을 때 한 조건만 참이면 결과가 True가 됩니다.
Condition 1 | Condition 2 | Result |
False | False | False |
True | False | True |
False | True | True |
True | True | True |
파이썬에서는 AND와 OR을 이렇게 사용할 수 있습니다.
print("0 and 0: ", 0 and 0)
print("1 and 0: ", 1 and 0)
print("1 and 1: ", 1 and 1)
print("0 or 0: ", 0 or 0)
print("1 or 0: ", 1 or 0)
print("1 or 1: ", 1 or 1)
Python에서 0은 flase, 1은 ture 입니다.
◡̈
'Python' 카테고리의 다른 글
[Python] 중첩 if 문 (0) | 2022.09.24 |
---|---|
[Python] If, elif, else 문 정리 (0) | 2022.09.24 |
[Python] for-each문이란? (0) | 2022.09.24 |
[Python] 문자열 대소문자 변환하기 (0) | 2022.09.24 |
[Python] 문자열 체크하는 함수 (isalpha, isdigit) (0) | 2022.09.24 |