Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribed

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 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+pts+ttut5q. Set w- 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 dayd 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 anuary 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions