Logins per Weekday

Medium ⏱ 12 min 63% acceptance ★★★★☆ 4.4
Given a list of date objects, write weekday_histogram(dates) returning a dict mapping weekday names ('Monday'…) to counts, including only weekdays that appear. strftime('%A') names the day.

Examples

Example 1
Input
weekday_histogram([date(2026, 7, 27), date(2026, 7, 27), date(2026, 7, 28)])
Output
{'Monday': 2, 'Tuesday': 1}
Explanation

Two Mondays and one Tuesday.

Constraints

  • Keys are full English day names.
  • Absent weekdays are absent keys.

Topics

Date & Timeaggregation

Companies

LinkedInMetaSlack

Hints

Hint 1

d.strftime('%A') or a names list indexed by weekday().

Hint 2

dict.get(k, 0) + 1 accumulates.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.