I'm fairly new to python and I'm trying to create a Season Checker. So far I only have spring, but when I run the code, nothing executes. Am I missing something?
def season_checker(month, day):
spring = 'March', 'April', 'May', 'June'
if (month == 'March' and 20 >= day >= 31):
spring = str(month), day, 'is a spring day'
elif (month == 'April' and 1 >= day >= 30):
spring = str(month), day, 'is a spring day'
elif (month == 'May' and 1 <= day <= 31):
spring = str(month), day, 'is a spring day'
elif (month == 'June' and 1 >= day >= 20):
spring = str(month), day, 'is a spring day'
else:
spring = str(month), day, 'is an unreconized month and day'
return spring
def main():
user_month = input("Enter month: ")
month = user_month.lower()
user_day = int(input("Enter day: "))
season = season_checker(user_month, user_day)
main()
Aucun commentaire:
Enregistrer un commentaire