Sort by another list's order
Write relative_sort(items, order) that sorts items so values appear in the order
they have in order, and any values not in order come after, sorted ascending.
order has distinct values.
relative_sort([2, 3, 1, 3, 2, 4, 6, 7, 9, 2, 19], [2, 1, 4, 3, 9, 6])
-> [2, 2, 2, 1, 4, 3, 3, 9, 6, 7, 19]
The point is to practise a key that looks up a rank in a dictionary.
def relative_sort(items, order):
...