Question: Problem 2: Write a function that takes as an argument a date in 2023 and returns the day of the week corresponding to that date.

 Problem 2: Write a function that takes as an argument a
date in 2023 and returns the day of the week corresponding to

Problem 2: Write a function that takes as an argument a date in 2023 and returns the day of the week corresponding to that date. The function should have the following signature: def weekDay (month, day): For example, weekDay (1,28) should evaluate to "Saturday" and weekDay (2,3) should evaluate to "Friday". You can assume that both arguments month and day are positive integers. But, it is possible that together month and day do not represent a valid date in 2023. In that case, the function should return the empty string . For example, weekDay (2,30), weekDay (20,5), and weekDay (10,200) should all evaluate to "'". Algorithm to use: The algorithm for this function consists of two steps. - Step 1: Given a particular month and day, first find the number of days that have passed since Jan 1 st, 2023. For example, if month =2 and day =3, then 33 days have passed since Jan 1st, 2023 and we are on Day 34. This quantity can be computed by a call to the previous function number0fdays. - Step 2: Since we are on Day 34, this means that 4 weeks have been completed since Jan 1st, 2023 and we are on Day 6 of Week 5. Now note that Jan 1st, 2023 is a "Sunday". Therefore, Day 6 of a week in the year 2023 is going to be "Friday". This is the string your function needs to return. Step 2 can be accomplished by using a giant if-statement. Note that your function should return one of the following 8 strings "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", or "". It should not return anything else and make sure the spelling of the strings is exactly correct. \# Complete this function \# \# The arguments month and day can be any positive integers, \# Examples: weekDay (1,28) should be "Saturday", weekDay (2,3) should be \# "Friday". \# weekDay (2,30), weekDay (20,5), and weekDay (10,200) should all be ", \# \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\# def weekDay (month, day)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!