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
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