Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
The Most Frequent Weekdays solution in Clear category for The Most Frequent Weekdays by JimmyCarlos
import datetime
def most_frequent_days(Y):
days = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
day_counts = {day:0 for day in days}
date_cur = datetime.datetime(Y,1,1)
while date_cur.year == Y:
day_counts[days[date_cur.weekday()]] += 1
date_cur += datetime.timedelta(days=1)
return [day for day in days if day_counts[day] == max(day_counts.values())]
July 22, 2019
Comments: