The Steadiest Team

Python for AIMedium+10 XP+10

The Steadiest Team

A quiz league ranks teams by their median round score, so one lucky round can't carry a team.

teams is a dictionary: each key is a team name and each value is that team's list of round scores.

Write best_median_team(teams) that returns the name of the team with the highest median.

  • Use statistics.median.
  • If two or more teams tie for the highest median, return the one that comes first A to Z.
  • There's always at least one team, and every team has at least one score.

(Owls' median is 6. Foxes' median is 3, even though they scored the single best round.)

Examples

teams = {"Owls": [5, 9, 6], "Foxes": [10, 2, 3]}
returns 'Owls'
teams = {"Solo": [4]}
returns 'Solo'

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