5. if

2023. 5. 2. 22:56python

weather = input("오늘 날씨는 어때요? ") # 눈
if weather == "비" or weather == "눈":
	print("우산을 챙기세요")
elif weather == "미세먼지":
	print("마스크를 챙기세요")
else:
	print("준비물 필요 없어요.")

'''
우산을 챙기세요
'''
# input 은 항상 문자열로 값을 받는다.
temp = int(input("기온은 어때요 ? ")) # 5
if 30 <= temp:
	print("너무 더워요. 나가지 마세요")
elif 10 <= temp and temp < 30:
	print("괜찮은 날씨에요")
elif 0 <= temp < 10:
	print("외투를 챙기세요")
else:
	print("추워요. 나가지 마세요")

'''
외투를 챙기세요
'''

 

'python' 카테고리의 다른 글

5. while  (0) 2023.05.02
5. for  (0) 2023.05.02
4. 퀴즈 #4  (0) 2023.04.25
4. 자료구조의 변경  (0) 2023.04.25
4. set  (0) 2023.04.25