A council promises to answer letters within a number of working days: Monday to Friday, except public holidays. Write deadline(start, days, holidays) that returns the date that is days working days after the date start.
- Dates are strings in the form
"YYYY-MM-DD", and the result is too. - The start day itself never counts; the first working day after it is day 1. If
daysis0, returnstartunchanged. - A negative
dayscounts backwards in the same way (-1is the last working day beforestart). holidaysis a list of date strings; those days are not working days.- An impossible date such as
"2026-02-30"raisesValueError.
The helper raises(fn, *args) returns the name of the exception raised (or None).
Examples
Input: deadline("2026-10-01", 3, [])
Output: "2026-10-06"
Explanation: 1 October 2026 is a Thursday. Friday is day 1, the weekend does not count,
Monday is day 2 and Tuesday is day 3.
Input: deadline("2026-12-23", 2, ["2026-12-25", "2026-12-28"])
Output: "2026-12-29"
Input: raises(deadline, "2026-02-30", 1, [])
Output: "ValueError"
Constraints
-10**5 <= days <= 10**5; dates are between the years 1900 and 2500.- Up to 1000 holidays.
Goals
- Use the standard library's `datetime` module instead of hand-written calendar arithmetic
- Parse and format ISO dates, step by days with `timedelta`, and find the weekday
- Let the library reject impossible dates