Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Most Frequent Weekdays solution in Clear category for The Most Frequent Weekdays by BrianMcleod
import datetime
def most_frequent_days(year):
"""
List of most frequent days of the week in the given year
"""
weekday = datetime.date(year, 1, 1).weekday()
leap = year%4==0 and (year%400==0 or year%100!=0)
return ['Monday','Tuesday','Wednesday','Thursday',
'Friday','Saturday','Sunday'][weekday:weekday+leap+1] if \
weekday+leap != 7 else ['Monday', 'Sunday']
Oct. 12, 2018
Comments: