Question: use integer division throughout python Let y be the 4-digit year, m be a 2-digit value corresponding to the month (for example, for March m=3,
use integer division throughout python
Let y be the 4-digit year, m be a 2-digit value corresponding to the month (for example, for March m=3, and for November m=11), and d be the 2-digit day.
If m is equal to 1 or 2 then reduce y by 1.
Set p equal to the last two digits of y.
Set q equal to the first two digits of y.
Set r=((m+9) mod 12)+1.
Set s=(13r-1)/5.
Set t=p/4.
Set u=q/4.
Set v=d+p+s+t+u+5q.
Set w=v mod 7.
The day of the week is given by the value of w, where w=0 would be Sunday. Write a Python program, in a file called day_of_week.py, to implement this algorithm asking the user for the year, month and day (each in the form of a numerical value). Your program should include the following functions:
getDayName(d) - returns a string representation of integer day d
getMonthName(m) - returns a string representation of integer month m
getDayNum(y,m,d) - returns the value of w as above
main()
Your output should be formatted as below.
Sample output 1:
Enter the 4-digit year: 1992 Enter the month as an integer: 1 Enter the day as an integer: 14 January 14 , 1992 is a Tuesday
Sample output 2:
Enter the 4-digit year: 2008 Enter the month as an integer: 8 Enter the day as an integer: 22 August 22 , 2008 is a Friday
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
