Expand one cron field into the sorted list of values it matches, given the field's allowed range
[low, high]. Support:
* (every value), a single number 5, a range 1-5*/15 and 10-30/101,3,10-12Raise ValueError for anything invalid or out of range. Return a sorted list without duplicates.
Implement expand_field. Input: field: str, low: int, high: int. Returns: list[int].
Invalid fields raise ValueError (the test harness reports it as the string 'ValueError').
This code runs before yours (fake clients, clocks and the test harness). You can use its names; don't edit them.
def __harness__(fn, field, low, high):
try:
return fn(field, low, high)
except ValueError:
return "ValueError"
def expand_field(field: str, low: int, high: int) -> list[int]:
return [int(field)]
Run executes the public tests. Submit grades against public and hidden tests.
Expand one cron field into the sorted list of values it matches, given the field's allowed range
[low, high]. Support:
* (every value), a single number 5, a range 1-5*/15 and 10-30/101,3,10-12Raise ValueError for anything invalid or out of range. Return a sorted list without duplicates.
Implement expand_field. Input: field: str, low: int, high: int. Returns: list[int].
Invalid fields raise ValueError (the test harness reports it as the string 'ValueError').
This code runs before yours (fake clients, clocks and the test harness). You can use its names; don't edit them.
def __harness__(fn, field, low, high):
try:
return fn(field, low, high)
except ValueError:
return "ValueError"
def expand_field(field: str, low: int, high: int) -> list[int]:
return [int(field)]
Run executes the public tests. Submit grades against public and hidden tests.