Skip to main content

Practice · 3 of 3

Top N by Score

CHALLENGE
Difficulty: intermediate+25 XP

Implement top_n(players, n) where players is a list of (name, score) tuples. Return a list of the n highest scores' names, highest first. Break ties by keeping the earlier player first (stable sort).

Back to lesson: Practice: Sorting with key