Question: Using Python 3 : Compose a program dayofweek that accepts a date as input and writes the day of the week on which that date

Using Python 3 : Compose a program dayofweek that accepts a date as input and writes the day of the week on which that date falls.

Your program should as the user for three values: m(month), d (day), and y(year). For m use 1 for January, 2 for february, and so forth. For output write 0 for sunday, 1 for Monday, 2 for Tuesday, and so forth. Note: You can assume that the user is entering a valid date.

Use the following formulas, for the gregorian calendar:

y0=y-(14-m)/12

x=y0+y0 / 4-y0 / 100+y0 / 400

m0=m+12 * ((14-m)/12)-2

d0=(d+x+(31*m0) / 12) %7

Also note that all divisions in the formulas are integer divisions. They represent the quotient part of the division between the two operands.

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!