Question

d = int(input('Enter the date: ')) m = int(input('Enter the month: ')) y = int(input('Enter the...

d = int(input('Enter the date: '))
m = int(input('Enter the month: '))
y = int(input('Enter the year: '))

if m<3:
m = m + 12
y = y - 1
a = (2*m) + (6*(m+1)/10)
b = y + (y/4) + (y/400) - (y/100)
c = d + a + b + 1
f = c / 7

if f == 0:
print ('Sunday')
elif f == 1:
print ('Monday')
elif f == 2:
print ('Tuesday')
elif f ==3:
print ('Wednesday')
elif f == 4:
print ('Thursday')
elif f == 5:
print ('Friday')
else:
print ('Saturday')

i have written this code but i cannot seem not get the right answer i only get saturday as a result. how can i fix it?

Homework Answers

Answer #1

d = int(input('Enter the date: '))

m = int(input('Enter the month: '))

y = int(input('Enter the year: '))

if m<3:

m = m + 12

y = y - 1

a = (2*m) + (6*(m+1)//10)

b = y + (y//4) + (y//400) - (y//100)

c = d + a + b + 1

f = c % 7

if f == 0:

print ('Sunday')

elif f == 1:

print ('Monday')

elif f == 2:

print ('Tuesday')

elif f ==3:

print ('Wednesday')

elif f == 4:

print ('Thursday')

elif f == 5:

print ('Friday')

else:

print ('Saturday')

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
The National Highway Traffic Safety Administration reported the percentage of traffic accidents occurring each day of...
The National Highway Traffic Safety Administration reported the percentage of traffic accidents occurring each day of the week. Assume that a sample of 420 accidents provided the following data. Sunday Monday Tuesday Wednesday Thursday Friday Saturday 69 47 54 49 58 69 74 a. Conduct a hypothesis test to determine if the proportion of traffic accidents is the same for each day of the week. What is the p-value? Compute the value of the X2 test statistic (to 3 decimals)....
CODE BLOCK D flag = 0 while flag == 0 : guess = input ("Select an...
CODE BLOCK D flag = 0 while flag == 0 : guess = input ("Select an option:\n1. Add a course\n2. Drop a course\n3. Print your registration.\n4. Quit\n\n>>> ") if guess.isdigit() : guess = int(guess) if guess == 1: print("Lets add a course") elif guess == 2: print("Lets drop a course") elif guess == 3: print("Lets print your registration") elif guess == 4: print("Bye") flag = 1 else: print(“Huh?”) If the user enters the value 5. What will print?
So, the brewery selected it’s place and now needs to hire folks. After some testing, they...
So, the brewery selected it’s place and now needs to hire folks. After some testing, they expect to have approximately 2,000 customers per week. Since they will be open 7 days a week, they need to hire people to help serve their beer. They know that Friday and Saturday will drive sales. Between these 2 days, they will get 50% of their weekly sales. So, Friday has 25% of sales and Saturday has 25% of the sales. As for Sunday...
Write a function num_day that takes a number in the range of 1 through 7 as...
Write a function num_day that takes a number in the range of 1 through 7 as a parameter and returns a string representing the corresponding day of the week, where 1=Monday, 2 =Tuesday, 3= Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday, and 7 = Sunday. The function should return the string "Error" if the parameter is that is outside the range of 1 through 7. You may assume that the parameter will be only numbers. Save the...
convert the while loop into for loop x = int(input('Enter initial value: ')) count = 0...
convert the while loop into for loop x = int(input('Enter initial value: ')) count = 0 if(x<1): print('Error') exit() print('Initial value is: ',x,' ',end='') while(x!=1): if(x%2==0): x=x/2 else: x=3*x+1 count+=1 if(x!=1): rint('Next value is: ',int(x),' ',end='') else: print('Final value ',int(x),', ',end='') print('number of operations performed ',int(count),' ',end='') break
PHP Question: _____________________________________________ Write the PHP code to list out all of the dates of the...
PHP Question: _____________________________________________ Write the PHP code to list out all of the dates of the current month and assign them to their given days. As an example, for the month of October 2020, the output should look something like this: October 2020       Monday: 5, 12, 19, 26 Tuesday: 6, 13, 20, 27 Wednesday: 7, 14, 21, 28 Thursday: 1, 8, 15, 22, 29 Friday: 2, 9, 16, 23, 30 Saturday: 3, 10, 17, 24, 31 Sunday: 4,...
USING MATLAB Code for pseudo Random Input N M=0 For i=1 to N X=rand# Y=rand# If...
USING MATLAB Code for pseudo Random Input N M=0 For i=1 to N X=rand# Y=rand# If X^2+ y^2 <= 1, then M=M+1 End the loop Print M/N (This is the probability) Print M/N (this is approximately = Py
Problem 9-09 (Algorithmic) Epsilon Airlines services predominantly the eastern and southeastern united States. The vast majority...
Problem 9-09 (Algorithmic) Epsilon Airlines services predominantly the eastern and southeastern united States. The vast majority of Epsilon’s customers make reservations through Epsilon’s website, but a small percentage of customers make reservations via phones. Epsilon employs call center personnel to handle these reservations and to deal with website reservation system problems and for the rebooking of flights for customers whose plans have changed or whose travel is disrupted. Staffing the call center appropriately is a challenge for Epsilon’s management team....
Scheduling in the restaurant Workforce management is central to efficient operations and good customer service. Proper...
Scheduling in the restaurant Workforce management is central to efficient operations and good customer service. Proper scheduling of employees can mean the difference between profitability and business failure. After faithfully serving the OM profession for 40 years, you decide to retire and open a restaurant. Among the hundreds of details with opening a restaurant, you need to hire and schedule employees. Based on the foot traffic of other restaurants in the area, you expect that you will need the following...
convert this code to accept int value instead of float values using python. Make sure to...
convert this code to accept int value instead of float values using python. Make sure to follow the same code. do not change the steps and make sure to point to what code you replaced. make sure to have 2 files Method:----------------------- #define a python user difined method def get_float_val (prompt): is_num = False str_val = input (prompt) #prming read for our while #while is_num == False: (ignore this but it works) old school while not is_num: try: value =...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT