● 학습 내용
1) 조건문 if
a. if - else
b. if - elif - else
ex) 윤년 계산
year = int(input("This Year: "))
if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
print("Leap year")
else:
print("Not leap year")
else:
print("Leap year")
else:
print("Not leap year")
ex) 피자 주문
https://github.com/yooyijun15/Python/tree/main/Day3
=> 관련 없는 조건이라면 따로 빼서 작성하는 것이 가독성 좋고 간결하다.
2) 관계연산자
- and, or, not
(+)
print(''' <- -> ''')
print('You\'re idea')
input().lower()
(연애 이름 궁합)
● GIT URL : https://github.com/yooyijun15/Python/tree/main/Day3
# count(): 포함된 문자 카운트하는 내장 함수
'여러가지 > Python' 카테고리의 다른 글
Day 6 - 사용자 함수 정의(def), 함수 호출, while 반복문 (1) | 2023.12.08 |
---|---|
Day 5 - for 반복문, shuffle(리스트 섞는 함수) (2) | 2023.12.07 |
Day 4 - 모듈, Random, 리스트, 내장함수 .split(), index() (1) | 2023.12.07 |
Day 2 - 내장함수 type(), int(), float(), round(), 연산, f 문자열 (1) | 2023.11.29 |
Day 1 - 줄바꿈, 연결, 입출력, 주석, 변수, 내장함수 str(), len() (0) | 2023.11.21 |