Everyone at the Top

Python for AIHard+10 XP+10

Everyone at the Top

A game ends and the scores are in a dictionary of player name to points.

Write top_scorers(scores) that returns a list of every player who has the highest score.

  • If several players tie for the top, include them all.
  • Sort the names alphabetically.
  • An empty dictionary gives an empty list.
  • Scores can be negative.

Examples

scores = {'ada': 7, 'bo': 9, 'cy': 9}
returns ['bo', 'cy']
scores = {"zed": 4, "amy": 12, "kim": 7}
returns ['amy']
scores = {}
returns []

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run