Solution for the "Date Validation" python coding challenge?
I'm having an issue with the Date Validation challenge in the Intro to Comp. Sci. course.
I'm stuck on the last step, getting a message that says "You changed your code in an unexpected way." I've already tried starting over, but I got the error message again. Can anyone help?
Code is as follows:
day = int(input("Enter a day (1-31): "))
if day < 1 or day > 31:
print("Error. Day must be between 1 and 31.")
month = int(input("Enter a month (1-12): "))
year = int(input("Enter a year: "))
if month < 1 or month > 12:
print("Error. Month must be between 1 and 12.")
if month == 6 and day > 30 or month == 4 and day > 30 or month == 9 and day > 30 or month == 11 and day > 30:
print("Error. Day must be within the month.")
if year <= 999 or year >= 9999:
print("Error. Year must have four digits.")
Iniciar sesión para dejar un comentario.