can you show me how to answer this on sypder using python as a calculator (zellers congruence) On what day of the week is Christmas Day (25th December) this year?
can you show me how to answer this on sypder using python as a calculator (zellers congruence)
On what day of the week is Christmas Day (25th December) this year?
Algorithm for Zeller's Congruence Function:
1. Start
2. Accept day, month, and year as input.
3. If month is less than 3, increment month by 12 and decrement the year by 1.
4. Calculate the following variables:
- q = day
- m = month
- K = year % 100
- J = year // 100
- f = q + ((13 * (m + 1)) // 5) + K + (K // 4) + (J // 4) - (2 * J)
- day_of_week = f % 7
(Zeller's Congruence assigns 0 to Saturday, 1 to Sunday, 2 to Monday, and so on.)
5. Convert day_of_week to 0 for Saturday, 1 for Sunday, 2 for Monday, and so on using the expression (day_of_week + 5) % 7.
6. Return the converted day_of_week.
7. End.
Algorithm for Calculating Christmas Day's Day of the Week:
1. Start
2. Call the Zeller's Congruence Function with inputs (25, 12, current_year) and store the result in day_of_week.
3. Create a list days_of_week with the names of the days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"].
4. Output the day of the week for Christmas Day using the statement:
- Print "Christmas Day (25th December) falls on a {days_of_week[day_of_week]} this year."
5. End.
Step by step
Solved in 4 steps with 2 images