Answered step by step
Verified Expert Solution
Question
1 Approved Answer
USING PYTHON PROGRAMMING 3.7 ON MAC!!!!!!! Problem Your task for this lab is to complete the next_holiday (year, month, day) function. This function accepts three
USING PYTHON PROGRAMMING 3.7 ON MAC!!!!!!!
Problem Your task for this lab is to complete the next_holiday (year, month, day) function. This function accepts three integer inputs representing a year, month, and a day and must return a two-element list containing a string with the name of the next Ontario statutory holiday and an integer representing the number of days until that holiday. The string with the name of the holiday should be all lower-case characters. The names of the holidays are given in the table below. To better understand the problem, consider the following example: >>> next holiday (2020,2,3) In this case, the input represents the date February 3rd, 2020. The next statutory holiday after this date is Family day on February 17th. So for this input, our function would return the following list: ['family day', 14] The first element in the returned list is a string with the name of the holiday. Note that all the characters in the string are lower-case. The second element in the list is the number of days until Family day. To simplify the problem, we will assume that all holidays will fall on the same date each year and we will use the 2020 dates. A list of all the statutory holidays and their corresponding date's are given below. Your function should check for leap years and adjust results appropriately. A year is a leap year if it satisfies one of the following conditions: . The year can be evenly divided by 4 and can not be evenly divided by 100, OR The year is evenly divisible by 400. For example, 1996 is a leap year because it satisfies condition 1, 2009 is not a leap year because it satisfies neither condition, and 2000 is a leap year because it satisfies condition 2. If the function is passed an invalid entry for the month or the day, the program should return ['invalid month',-1] or ['invalid day',-1], respectively. If passed both an invalid month and an invalid day, the program should return ['invalid month',-1]. 3/4 Ontario statutory morruays ana Zuzu vates Holiday Name new year's day family day good friday victoria day canada day civic holiday labour day thanksgiving day Date* Jan 1 Feb 17 Apr 10 May 18 Jul 1 Aug 3 Sep 7 Oct 12 christmas day Dec 25 boxing day Dec 26 * for simplicity assume Family Day, Good Friday, Victoria Day, Civic Holiday, Labour Day, and Thanksgiving day fall on these dates each year. Example Test Cases Inputs next_holiday (2019,1, 31) next_holiday (2019,13,3) next_holiday (2040,8,2) next_holiday (2022,2,29) next_holiday (2021,9,19) next_holiday (2020,2,29) next_holiday (2008,12,25) next_holiday (2022,12,28) Output ['family day', 17] ['invalid month', -1] ['civic holiday', 1] ['invalid day', -1] ['thanksgiving day' ,23] ['good friday', 41] ['boxing day', 1] ["new year's day", 4] When you have completed and tested all the functions, submit it for grading on MarkUs. IMPORTANT: Do not change the file name or function names. Do not use input() or print () inside the functions. Five test cases are provided on MarkUs. You should test your code before your final submission. These test cases will be used in grading with an additional five test casesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started