Q3-4.py 월로 계절 판별

10 P
QUESTION 13 #592
월을 입력받아 봄/여름/가을/겨울을 출력합니다. 빈칸에 들어갈 알맞은 조건을 채우세요.

예시 입력: 7
main.py
month = int(input("월을 입력해주세요 : "))

if month >= 3 and month <= 5 :
   season = "봄"

   print(month, "월은 ", season, "입니다", sep="")
elif month >= 6  month <= 8 :
   season = "여름"
   print(month, "월은 ", season, "입니다", sep="")
elif month >= 9 and month <= 11 :
   season = "가을"
   print(month, "월은 ", season, "입니다", sep="")
elif month == 12  month == 1 or month == 2 :
   season = "겨울"
   print(month, "월은 ", season, "입니다", sep="")
else  :
   print("월이 잘못 입력되었습니다!")
실행 결과 예시
7월은 여름입니다
INTERACTIVE SHELL Shift + Enter 로 즉시 실행