Question: (python3) output should as same as the example Write a function dayOfWeek that has 3 integer input arguments (month, day, year) and returns one value
(python3) output should as same as the example
Write a function dayOfWeek that has 3 integer input arguments (month, day, year) and returns one value (the day of the week on which that date falls, as an integer: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so forth.) Note: You can assume that the tests will be using as input valid dates. Use the following formulas, for the Gregorian calendar: oy-(14-m)/12 x = y0 + y014-y0/100 + y01400 m0 = m + 12"(14-m) / 12)-2 dos(d + x + (31*mo)/ 12) 96 7 The value of do will give you the day of the week Please note that all the divisions in the formulas above are integer divisions. They represent the quotient part of the division between the two operands. For example, on what day of the week was August 2, 1953? y 1953-0 1953 x = 1953 + 1953/4-1953/100 + 1953/400-2426 m=8+12*0-2=6 d (2 + 2426 + (31*6)/ 12) % 7-2443 % 7-0 (Sunday) Here's an example of a possible test: >> print(dayOfweek(8, 2, 1953))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
