Write a Python program that accepts a date in the form “month/day/year” and prints whether or not the date is valid. For example 5/24/1962 is valid, but 9/31/2000 is not. (September has only 30 days.)...


Write a Python program that accepts a date in the form “month/day/year” and prints whether or not the date is valid. For example 5/24/1962 is valid, but 9/31/2000 is not. (September has only 30 days.)



  • Must use if-elif-else statements to make decisions in your program.

  • The function main() should print a friendly message and ask for the input of the date in the required format (see above). It then should parse the date into its day, month and year components. It will pass this information to a “date check” function.

  • A “date check” function named is_valid_date(day, month, year) that will take these date components of day, month and year and checks to see if that date is valid.

  • The function parameters day, month, and year must be integer values.

  • This function is required to return a Python True or False boolean value (reflecting a valid, or invalid date, respectively) that your main() function will use to print out the correct message about the date’s validity.

  • A function named is_leap_year(year) that calculates leap year needs to be used by your date check function. This formula should be easy to look up.

  • The function parameters year must be an integer value.

  • Write this function that takes takes a year as a parameter that will then return a Python True or False boolean value (reflecting a leap, or non-leap year, respectively).

  • DO NOT use the function eval.



Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here