반응형
# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
def func_a(month, day):
month_list = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
total = 0;
for i in range(month-1):
total += month_list[i]
total += day
return total - 1
def solution(start_month, start_day, end_month, end_day):
start_total = func_a(start_month, start_day)
end_total = func_a(end_month, end_day)
return end_total - start_total
start_month = 1
start_day = 2
end_month = 2
end_day = 2
ret = solution(start_month, start_day, end_month, end_day)
print("solution 함수의 반환 값은", ret, "입니다.")
생각해보면 어렵지 않은 문제였는데 괜히 빈칸으로 나와서 생각이 꼬였었다.
'IT > Cos Pro 2급 파이썬' 카테고리의 다른 글
[Cos Pro 2급 파이썬] 배열의 순서 뒤집기 (0) | 2024.07.27 |
---|---|
[Cos Pro 2급 파이썬] 등장하는 가장 많은 수와 적은수 구하기 (0) | 2024.07.27 |
[Cos Pro 2급 파이썬] 쇼핑몰 등급별 할인 금액구하기 (0) | 2024.07.27 |
[Cos Pro 2급 파이썬] 단체 티셔츠를 주문하기 (0) | 2024.07.27 |