Now that challenge created a nice set of date related one-liners in Python.
from datetime import timedelta, date from collections import Counter days_in_year = lambda year: int((date(year, 12, 31) - date(year, 1, 1)).days) iterate_year = lambda year: [date(year, 1, 1) + days * timedelta(days=1) for days in range(days_in_year(year) + 1)] weekdays = lambda year: [day.strftime('%A') for day in iterate_year(year)] max_dict_val = lambda d: [key for key, value in d.items() if value == max(d.values())] for year in [2427, 2185, 2860, 1770, 1785, 1984, 2000]: print(f'Most frequent day(s) in {year} is/are: {max_dict_val(Counter(weekdays(year)))}')
Try it online!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Now that challenge created a nice set of date related one-liners in Python.
Try it online!