티스토리 뷰
Determine the season for a given date. You may assume that the start and end of each season is fixed to the dates given in the table below.
season | start date | end date |
---|---|---|
spring | 21 March | 20 June |
summer | 21 June | 22 September |
autumn | 23 September | 20 December |
winter | 21 December | 20 March |
Input
The day () and the name of the month for a given date, each on a separate line.
Output
A sentence that describes the season at the given date. Use
It is season on month day.
as a template for the description, where fragments in italics have to be filled up based on given and computed information.
Example
Input:
15 March
Output:
It is winter on March 15.
Epilogue
There's no mistaking a portrait by Giuseppe Arcimboldo (1527-1593) — the Milanese painter represented his subjects as masses of flowers, vegetables, fruits, and fish. These personifications of the four seasons were composed between 1563 and 1573.
Three years after personifying the four seasons, Giuseppe Arcimboldo did the same for the four elements.
Around 1590 he also painted this Testa con cestino di frutta reversibile (Head with reversible fruit basket).
def get_season(day, month):
if month == "March" and day >= 21 or month == "April" and day <= 30 or month == "May" or month == "June" and day <= 20:
season = "spring"
elif month == "June" and 21 <= day <= 30 or month == "July" or month == "August" or day <= 22 and month == "September":
season = "summer"
elif month == "September" and 23 <= day <= 30 or month == "October" or day <= 30 and month == "November" or day <= 20 and month == "December":
season = "autumn"
else:
season = "winter"
print("It is {} on {} {}.".format(season, month, str(day)))
get_season(int(input()), str(input()))
'python lecture > algorism' 카테고리의 다른 글
[edu] 수 찾기 (0) | 2018.11.21 |
---|---|
[edu] 가장 좋아하는 수 구하기 (0) | 2018.11.21 |
[edu] Isomers (0) | 2018.11.04 |
[edu] Applied chemistry (0) | 2018.11.02 |
[edu] Friday the 13th (0) | 2018.10.24 |
- Total
- Today
- Yesterday
- PuTTYGen
- GIT
- 모바일 테마 적용
- virtualenv
- pycrypto
- 파이썬 프로그래밍
- 장고 카톡 자동응답
- 장고
- wsgi
- django
- 파이썬 강좌
- 모바일 스킨 적용
- 면접답변
- 문과 코딩
- 이미지 비교
- gitignore
- admin.py
- 면접정답
- 파이썬 입문
- 엑셀 비교
- 문서 비교
- 파이썬
- gitlab
- 파이썬 독학
- Python
- 장고 플러스친구 자동응답
- Tistory
- 플러스친구 자동응답
- chatbot
- django chatbot
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
29 | 30 | 31 |