Can every course be taken?

prereqs is a dictionary from each course to the courses required before it; every course is a key. Write can_finish(prereqs) that returns whether it is possible to take them all, which fails only when requirements go round in a circle.

can_finish({"a": [], "b": ["a"]})       ->  True
can_finish({"a": ["b"], "b": ["a"]})    ->  False
can_finish({"a": ["a"]})                ->  False

The point is to practise cycle detection in a directed graph.

def can_finish(prereqs):
    ...