Question

USE PYTHON ONLY PLEASE Zeller’s congruence is an algorithm developed by Christian Zeller to calculate the...

USE PYTHON ONLY PLEASE

Zeller’s congruence is an algorithm developed by Christian Zeller to calculate the day of the week. The formula is

h = (q + 26(m+1)//10 + k + k//4 +j//4 +5j) % 7

where

- h is the day of the week (0: Saturday, 1: Sunday, 2: Monday, 3: Tuesday, 4: Wednesday, 5: Thursday, 6: Friday).
- q is the day of the month.
- m is the month (3: March, 4: April, ..., 12: December). January and February are counted as months 13 and 14 of the previous year.
- j is year//100.
- k is the year of the century (i.e., year % 100).

Write a program that prompts the user to enter a year, month, and day of the month, and then it displays the name of the day of the week.

Sample Run 1

Enter year: (e.g., 2008): 2013

Enter month: 1-12: 1

Enter the day of the month: 1-31: 25

Day of the week is Friday

Sample Run 2

Enter year: (e.g., 2008): 2012

Enter month: 1-12: 5

Enter the day of the month: 1-31: 12

Day of the week is Saturday

Hint: Use the // operator for integer division. January and February are counted as 13 and 14 in the formula, so you need to convert the user input 1 to 13 and 2 to 14 for the month and change the year to the previous year.

Homework Answers

Answer #1

Here is your code :-

year=int(input('Enter year: (e.g., 2008): '))
month=int(input('eEnter month: (1-12) : '))
day=int(input('enter day of the month : (1-31) : '))
q=day
j=year/100
k=year%100
m=month
h=((q+1)+(26*(m+1)/10)+k+(k/4)+(j/4)+(5*j))%7
day_name=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']
print('Day of the week is :',day_name[int(h)])

Output :

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Use the table below to determine the corresponding genotype and phenotype of the critter you have...
Use the table below to determine the corresponding genotype and phenotype of the critter you have created. Traits Suite Dominant Cards Recessive Cards Number of spots Hearts 4 spots (N*) K,Q,J, 10, 9, 8 2 spots (nn) 7, 6, 5, 4, 3, 2 Body color Clubs Red (R*) K,Q,J, 10, 9, 8 Orange (rr) 7, 6, 5, 4, 3, 2 Antennae length Diamonds Short (A*) K,Q,J, 10, 9, 8 Long (aa) 7, 6, 5, 4, 3, 2 Body size Spades...
Use the information in the following stock quote to calculate Abercrombie & Fitch’s earnings per share...
Use the information in the following stock quote to calculate Abercrombie & Fitch’s earnings per share over the last year. (Round your answer to 2 decimal places. (e.g., 32.16)) (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) (15)   Name Symbol Open High Low Close Net Chg %Chg Volume 52 Week High 52 Week Low Div Yield PE YTD %Chg   Abercrombie & Fitch ANF 28.89 29.41 28.20 28.60 −1.11 −3.74 2,334,747 42.12 19.76 0.60 2.10...
The following algorithm finds the initial substring of y that can be reversed and found in...
The following algorithm finds the initial substring of y that can be reversed and found in y. For example, longestInitialReverseSubstringLength(“aabaa”) = 5, because “aabaa” is the same string forwards and backwards, so the longest initial substring that can be reversed and found in the string is “aabaa”. Also, longestInitialReverseSubstringLength(“bbbbababbabbbbb”) is 6, because “babbbb” can be found in the string (see color-highlighted portions of the string), but no longer initial string exists reversed in any part of the string. longestInitialReverseSubstringLength(String y)...
****HOW DO I CALCULATE #15 and #16 AT THE BOTTOM?** January Arya and Rob have decided...
****HOW DO I CALCULATE #15 and #16 AT THE BOTTOM?** January Arya and Rob have decided to open a doggy day care, Stark's Direwolf Lodge (SDL). On 1/1/2016, Arya and Rob each contribute $10,000 in exchange for 100 shares each of common stock to get things started (1). Before they can open SDL, they needed a location. After doing their due diligence, they found a centrally located building with ample space for dog lodging and play area. The building and...
Please do the following in python: Write a program (twitter_sort.py) that merges and sorts two twitter...
Please do the following in python: Write a program (twitter_sort.py) that merges and sorts two twitter feeds. At a high level, your program is going to perform the following: Read in two files containing twitter feeds. Merge the twitter feeds in reverse chronological order (most recent first). Write the merged feeds to an output file. Provide some basic summary information about the files. The names of the files will be passed in to your program via command line arguments. Use...
Brothers Harry and Herman Hausyerday began operations of their machine shop (H & H Tool, Inc.)...
Brothers Harry and Herman Hausyerday began operations of their machine shop (H & H Tool, Inc.) on January 1, 2016. The annual reporting period ends December 31. The trial balance on January 1, 2018, follows (the amounts are rounded to thousands of dollars to simplify): Account Titles Debit Credit Cash $ 3 Accounts Receivable 5 Supplies 12 Land 0 Equipment 69 Accumulated Depreciation $ 6 Software 24 Accumulated Amortization 4 Accounts Payable 5 Notes Payable (short-term) 0 Salaries and Wages...
  1.     In the first month of operations, the total of the debit entries to the cash...
  1.     In the first month of operations, the total of the debit entries to the cash account amounted to $1900 and the total of the credit entries to the cash account amounted to $800. The cash account has a balance of……………….     2.     Dawson’s Delivery Service purchased equipment for $3,500. Dawson paid $500 in cash and signed a note for the balance. Dawson debited the Equipment account, credited Cash and a.   debited the Dawson, Capital account for $2,000. b.   credited...
Brothers Harry and Herman Hausyerday began operations of their machine shop (H & H Tool, Inc.)...
Brothers Harry and Herman Hausyerday began operations of their machine shop (H & H Tool, Inc.) on January 1, 2013. The annual reporting period ends December 31. The trial balance on January 1, 2015, follows (the amounts are rounded to thousands of dollars to simplify):   Account Titles Debit Credit   Cash $ 4   Accounts Receivable 4   Supplies 11   Land 0   Equipment 65   Accumulated Depreciation $ 7   Software 21   Accumulated Amortization 5   Accounts Payable 6   Notes Payable (short-term) 0   Salaries and Wages...
Required information [The following information applies to the questions displayed below.] Brothers Harry and Herman Hausyerday...
Required information [The following information applies to the questions displayed below.] Brothers Harry and Herman Hausyerday began operations of their machine shop (H & H Tool, Inc.) on January 1, 2016. The annual reporting period ends December 31. The trial balance on January 1, 2018, follows (the amounts are rounded to thousands of dollars to simplify): Account Titles Debit Credit Cash $ 3 Accounts Receivable 5 Supplies 12 Land 0 Equipment 58 Accumulated Depreciation $ 6 Software 16 Accumulated Amortization...
Brothers Harry and Herman Hausyerday began operations of their machine shop (H & H Tool, Inc.)...
Brothers Harry and Herman Hausyerday began operations of their machine shop (H & H Tool, Inc.) on January 1, 2016. The annual reporting period ends December 31. The trial balance on January 1, 2018, follows (the amounts are rounded to thousands of dollars to simplify): Account Titles Debit Credit Cash $ 4 Accounts Receivable 4 Supplies 11 Land 0 Equipment 53 Accumulated Depreciation $ 7 Software 20 Accumulated Amortization 7 Accounts Payable 6 Notes Payable (short-term) 0 Salaries and Wages...