
Predict
Stable Sorting
A sort is stable if items that compare equal keep their original order.
Python's sorted() and .sort() are always stable (they use an algorithm
called Timsort, O(n log n)).
crew = [("Ada", 3), ("Bo", 1), ("Cy", 3), ("Di", 1)]
by_rank = sorted(crew, key=lambda c: c[1])
print([name for name, rank in by_rank])