Find ready steps in a validated plan
Implement ready_steps(plan, completed). Plan maps nonempty string step IDs to lists of predecessor IDs. Reject duplicate predecessors, unknown predecessors, cycles, or unknown completed IDs with ValueError. Return incomplete steps whose predecessors are all completed, sorted lexically. An empty plan with an empty completed set returns []. Validate the whole graph even when a bad branch is unrelated to the current ready set.
Your task
- Complete the starter function using the contract above.
- Use the examples and visible tests to check normal inputs, boundaries, and rejected inputs.
- Run tests to record your result, then compare with the explained reference solution.
Examples
EXAMPLE 1
Inputready_steps({"a":[],"b":["a"],"c":["a"]},{"a"})
Output["b", "c"]
EXAMPLE 2
Inputready_steps({"a":[],"b":["a"]},set())
Output["a"]
Implement the function, then run the tests.
Ctrl / ⌘ + Enter to test · Shift + Tab leaves editor