0

Given that first of January is a wednesday (or any other day of the week), I'd like to know the day of each Monday and Sunday of a calendar.

Taking into consideration leap years.

This is what I did:

leap = False 
    count = 0
    days_of_week = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
    start_week = {}
    # month and number of days in a month
    months = {"January": 31, "February": 28, "March": 31, "April": 30, "May": 31, "June": 30, "July": 31, "August": 31, "September": 30, "October": 31, "November": 30, "December": 31}
    
    for key, value in months.items():
        print(key, '->', value)
        start_week[key] = {"start": days_of_week[0], "end": days_of_week[-1]}
        print(start_week)
    
    if Y >= 2001 and Y <= 2100:
        if Y % 4 == 0:
            leap = True
        
        else:
            for w in days_of_week:
                print(f"{w} : {count}")
                count+=1
            
        print(leap)
Ana Claudia
  • 501
  • 6
  • 16

0 Answers0