Program 01 CS106 Summer 2026 Instructor: Michael Eckmann Due: July 09, 2026 by 11:59 p.m. SUBMIT dates.py to the Spring ========================================================================== In this assignment you will write a program that checks to see if a date entered by the user is a valid date (since the year 1583). A skeleton of the program is below. As indicated by the comments in the program, fill in the following: 1. An assignment statement that sets monthValid to True if the month entered is between 1 and 12, inclusive, otherwise set it to False. 2. An assignment statement that sets yearValid to True if the year is between 1583 and 2025, inclusive, otherwise set it to False. 3. If/elif/else statements that determine the number of days in the month entered and stores that number of days in the month into a variable named days_in_month. (e.g. if the user entered 3 for the month you should store 31 in days_in_month because there are 31 days in March.) Note that you can assume February has only 28 days maximum. If the month entered by the user is not valid (that is not 1 through 12), days_in_month can be assigned any value. 4. An assignment statement that sets dayValid to True if the day entered is valid for the given month. (e.g. 31 is not valid for month 4, 0 or negative days are not valid for any months, etc.) Otherwise set it to False. 5. If the month, day, and year entered are all valid, print 'Date is valid'. If any part of the date entered is not valid, print 'Date is not valid'. # **************************************************************** # dates.py # # Determine whether a date entered by the user # is valid since beginning of year 1583 until end of year 2025. # Note: 1583 is the first full year of the use of the Gregorian Calendar # **************************************************************** # name your input variables month, day and year # Get month, day, and year from user - with 3 different calls to input # Check to see if month is valid (see 1.) # Check to see if year is valid (see 2.) # store the appropriate value in days_in_month # Use days_in_month and day entered by user to check to see if day is valid # the following if / else will work (solves 4.) if day in range(1, days_in_month + 1): # OR alternatively could do if day > = 1 and day <= days_in_month: dayValid = True else: dayValid = False # Determine whether date is valid (month, day and year are all valid) with an if else # statement and print appropriate message (see 5.) # Add your name and date to the comments at the top # Feel free to add single line comments explaining what some of your code is doing. # Probably necessary for comments to be added near the leap year code (see below) if you do it. ====================================== Extra credit: Determine if the year entered by the user is a leap year (then February has 29 days.) Add an assignment statement that sets leapYear to True if the year is a leap year; set it to False if it is not a leap year. Here is the leap year rule: If the year is divisible by 4, it's a leap year UNLESS it's divisible by 100, in which case it's not a leap year UNLESS it's divisible by 400, in which case it is a leap year. If the year is not divisible by 4, it's not a leap year. Put another way, it's a leap year if a) it's divisible by 400, or b) it's divisible by 4 and it's not divisible by 100. So 1600 and 1612 are leap years, but 1700 and 1614 are not. 1600 is leap year because it is divisible by 400 1612 is a leap year because it is NOT divisible by 400, it is divisible by 4, but not divisible by 100 1700 is NOT a leap year because it is divisible by 100, but not 400 1614 is NOT a leap year because it is not divisible by 4 After printing out that the date is valid or not, also print a line stating that the year entered is a leap year if it is, and nothing else if it isn't a leap year. ====================================== Extra credit 2 (worth lots of points if correct): For valid dates, display what day of the week it was. e.g. June 5 2023 (entered as 6 then 5 then 2023) was a Monday January 1, 1583 was a Saturday