Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
calendar and datetime solution in Clear category for The Most Frequent Weekdays by tommy6073
import calendar
from datetime import date
def most_frequent_days(year):
if calendar.isleap(year):
first_weekday = calendar.day_name[date(year, 1, 1).weekday()]
second_weekday = calendar.day_name[date(year, 1, 2).weekday()]
if first_weekday == "Sunday":
return [second_weekday, first_weekday]
else:
return [first_weekday, second_weekday]
else:
return [calendar.day_name[date(year, 1, 1).weekday()]]
March 23, 2016