Question: Write definitions for the following two functions: isLeap(year) returns True if year is a leap year, otherwise False Note: - A year is a leap
Write definitions for the following two functions: isLeap(year) returns True if year is a leap year, otherwise False Note: - A year is a leap year if it is divisible by 4 , unless it is a century year that is not divisible by 400. (For example, 1800 and 1900 are not leap years while 1600 and 2000 are). isValidDate(month, day, year) returns True if date is valid, otherwise False Note: - Month of [1,3,5,7,8,10,12]:31 days - Month of [4,6,9,11]:30 days - Month of February, call your isleap() function to adjust the last day of the month. Write a Python program using these functions that prompts the user to enter a date in the form month/day/year and outputs if the date is valid or not as shown in the test cases. Program Input Enter a date ( mm/dd/yyyy) : - You can assume that the user always enters a date in the instructed form (mm/dd/yyyy), no error checking needed. Program Output The date is valid or (invalid). Test Case 1: Welcome to Date Validator! Enter a date (mm/dd/yyyy): 4/31/2022 The date is invalid. Test Case 2: Welcome to Date Validator! Enter a date (mm/dd/yyyy): 2/29/2024 The date is valid. Test Case 3: Welcome to Date Validator! Enter a date (mm/dd/yyyy): 10/11/2022 The date is valid
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
