Question: Given data are stored in lists month _ name = [ January , Febrary, March, April, May, June, July, August, September, October,November, December

Given data are stored in lists
month_name =["January", "Febrary", "March", "April", "May", "June",
"July", "August", "September", "October","November", "December" ]
month_day =[31,29,31,30,31,30,31,31,30,31,30,31] # Feb has 29 days
extra =[1,4,5,1,3,6,1,4,0,2,5,0]
week_day =["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
# code here
# Define month names
month_name ={1: "January", 2: 'February', 3: 'March', 4: 'April', 5: 'May', 6: 'June', 7: 'July', 8: 'August', 9:'September', 10: 'October', 11: 'November', 12: 'December'}
# Define number of days in each month for non-leap year and leap year
nly_month_day =[31,28,31,30,31,30,31,31,30,31,30,31]
ly_month_day =[31,29,31,30,31,30,31,31,30,31,30,31]
# Given 2024 Jan. 1 falls on a Mon.
offset_o =7
# Get year and month from user input
yyyy = int(input("Please Enter the year you would like to print(0): "))
for mm in range(1,13):
# Calculate odd days
day =(yyyy -1)%400
day =(day //100)*5+((day %100)-(day %100)//4)+((day %100)//4)*2
day = day %7
# Calculate number of days in the month
if yyyy %4==0:
d = sum(ly_month_day[:mm-1])
else:
d = sum(nly_month_day[:mm-1])
# Add odd days and offset to get starting day of the month
day += d %7
day = day %7
# Print month and year
print("{0}{1}".format(month_name[mm], yyyy).center(200))
print("Sun Mon Tue Wed Thu Fri Sat")
# Print calendar for the month
if mm in [4,6,9,11]:
days_in_month =30
elif mm ==2:
if yyyy %4==0:
days_in_month =29
else:
days_in_month =28
else:
days_in_month =31
for i in range(1, days_in_month +1):
if i ==1:
print(""*1* day, end="")
if i <10:
print("", end="")
print(i, end="")
if (i + day)%7==0:
print()
else:
print("", en

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!