Q64. 월을 입력 받아 그에 해당되는 계절 이름을 출력하는 프로그램을 작성하시오. 단, 1~12 외의 숫자가 입력되었을 때에는 "월이 잘못 입력되었습니다!"를 출력한다. (200점)
_____ = int(input("월을 입력해주세요 : "))
_____ month == 3 or month == 4 or month == 5 :
print("%d월은 봄이다" % month)
_____ month == 6 or month == 7 or month == 8 :
print("%d월은 여름이다" % month)
_____ month == 9 or month == 10 or month == 11 :
print("%d월은 가을이다" % month)
_____ month == 12 or month == 1 or month == 2 :
print("%d월은 겨울이다" % month)
_____ :
print("월이 잘못 입력되었습니다!")
- 난이도(1~10) : 2
- 힌트 : 없음
- - 실행 결과
-
월을 입력해주세요 : 10
10월은 가을이다.
month = int(input("월을 입력해주세요 : "))
if month == 3 or month == 4 or month == 5 :
print("%d월은 봄이다" % month)
elif month == 6 or month == 7 or month == 8 :
print("%d월은 여름이다" % month)
elif month == 9 or month == 10 or month == 11 :
print("%d월은 가을이다" % month)
elif month == 12 or month == 1 or month == 2 :
print("%d월은 겨울이다" % month)
else :
print("월이 잘못 입력되었습니다!")