Topological sort
Write build_order(deps) where deps maps each task to the of tasks it depends on. Return a list containing every task exactly once, such that each task comes after all of its dependencies. Raise ValueError if there is a cycle. When several orders are valid, any one is accepted.
Examples
build_order({"app": ["lib", "utils"], "lib": ["utils"], "utils": []}) → ["utils", "lib", "app"]Exercise
4 checksTopological sort
def build_order(deps):
...
print(build_order({"app": ["lib", "utils"], "lib": ["utils"], "utils": []}))
Press Run to try your code, then Check answer to grade it.