#557 · Dictionaries and sets · Beginner · 30 XP · about 4 min
Write top_scorer(scores) that takes a dictionary mapping each player's name to their score and returns the name of the player with the highest score.
If two or more players share the highest score, return the one that comes first in the dictionary. If the dictionary is empty, return None.
top_scorer({'Ana': 12, 'Ben': 19, 'Cy': 7}) # returns 'Ben' top_scorer({'Ana': 10, 'Ben': 10}) # returns 'Ana' top_scorer({}) # returns None
Scores are whole numbers and can be negative.
First solves only, ranked by stars and then time.