I suspect the error is how you are inputting the months. In your code, the input is case-sensitive. So you need to input April
or March
etc.
You can improve your code by sanitizing the input string (e.g., stripping whitespace and converting to lowercase) and by using the in
statement.
month = input("Enter month : ")
month = month.strip() # strip whitespace on either end of the string.
month = month.lower() # convert to lowercase.
days = 31
if month in {"april", "june", "september", "november"}:
days = 30
elif month == "february":
days = "28 or 29"
print(days)
In the code above, {"april", "june", "september", "november"}
is a set
. It is quick to look up whether values are in a set
.