Date Ranges with Filters

easy
Unit 7 · Datetime I0/3 to milestone

Implement date_range(start, end, step_days=1, weekdays=None) that yields datetime.date objects from start to end inclusive, every step_days days. If weekdays is given (a set of numbers where Monday = 0), only yield dates on those weekdays. start and end are ISO strings ("2024-03-01").

It must be a generator. If start > end, yield nothing.

#datetime#generators2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Date Ranges with Filters · TechGradify