I know this is simple but I can't get this code to work. No matter the order I put the variables or if/elif statements in, it only returns the if statement regardless of the month.
months = input("Enter a month to find out how many days are in that month, or enter 'exit' to quit the program\n")
months_28 = "February"
months_30 = "April", "June", "September", "November"
months_31 = "January", "March", "May", "July", "August", "October", "December"
if months or months.casefold() in months_28:
print("There are 28 days in", months.capitalize())
elif months or months.casefold() in months_30:
print("There are 30 days in", months.capitalize())
elif months or months.casefold() in months_31:
print("There are 31 days in", months.capitalize())
else:
print("That's not a month")
I also am trying to work a while loop into this too (as reflected in the beginning) and any help there would be greatly appreciated. Cheers
Aucun commentaire:
Enregistrer un commentaire