Given a five-field cron expression (minute hour day-of-month month day-of-week) and a start time
"YYYY-MM-DDTHH:MM", return the next matching time strictly after the start, in the same format.
*, numbers, ranges a-b, steps */n and a-b/n, and comma lists.*), a day matches when either matches
(classic cron). Otherwise only the restricted one applies.None if nothing matches within the next 5 years (e.g. February 30th).Implement next_run. Input: expr: str, start: str. Returns: str | None.
Friday after 17:45 → Monday 09:00.
from datetime import datetime, timedelta
def next_run(expr: str, start: str):
t = datetime.fromisoformat(start) + timedelta(minutes=1)
return t.strftime("%Y-%m-%dT%H:%M")
Run executes the public tests. Submit grades against public and hidden tests.
Given a five-field cron expression (minute hour day-of-month month day-of-week) and a start time
"YYYY-MM-DDTHH:MM", return the next matching time strictly after the start, in the same format.
*, numbers, ranges a-b, steps */n and a-b/n, and comma lists.*), a day matches when either matches
(classic cron). Otherwise only the restricted one applies.None if nothing matches within the next 5 years (e.g. February 30th).Implement next_run. Input: expr: str, start: str. Returns: str | None.
Friday after 17:45 → Monday 09:00.
from datetime import datetime, timedelta
def next_run(expr: str, start: str):
t = datetime.fromisoformat(start) + timedelta(minutes=1)
return t.strftime("%Y-%m-%dT%H:%M")
Run executes the public tests. Submit grades against public and hidden tests.