Write a Python function that displays a one-year calendar for any year. The program should prompt the user for a year (past, present or future). Then the program should calculate, the weekday for Jan 1 for that year. there is an equation for calculating this value, which is given as: day = R(1+5R(Y-1,4)+4(Y-1,100)+6R(Y-1,400),7) R(x,y) is remainder after the division of x by y, and Y is the year. The equation produces a value between 0 and 6, where 0 is Sunday, 1 is Monday,….6 is Saturday.
I am having trouble implementing this equation correctly in Python3. I am wondering how I would write this. Thanks
If you have any doubts, please give me comment...
months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
dayNames = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
Y = int(input("Enter year: "))
day = (1+5*((Y-1)%4)+4*((Y-1)%100)+6*((Y-1)%400))%7
if (((Y % 4 == 0) and (Y % 100 != 0)) or (Y % 400 == 0)):
days[1] += 1
for i in range(12):
print("\t"+months[i]+", "+str(Y))
for j in range(7):
print("%3s"%dayNames[j], end=' ')
print()
print(' '*day, end='')
for j in range(1, days[i]+1):
print("%3d"%j, end=' ')
if (j+day)%7==0:
print()
print("\n")

Write a Python function that displays a one-year calendar for any year. The program should prompt...