Group Valid Event Dates by Month

Count valid event dates by YYYY-MM and return a dictionary of month counts. Each valid date must be an exact ASCII YYYY-MM-DD string representing a real Gregorian date. Use datetime parsing; skip invalid dates, non-string entries and other formats. Count duplicates as separate events.

Difficulty: intermediate

Examples

  • [["2024-02-01","2024-02-29","2024-03-01"]]{"2024-02":2,"2024-03":1}

Your solution

Python

Results

Python starts when you run or submit this challenge.

Back to Lesson