The Steadier Player

Data with PythonMedium+10 XP+10

The Steadier Player

A darts coach wants to know which of two players is more consistent: whose scores stay closest to their own average.

Task: write steadier(scores_a, scores_b). Measure each player's spread with NumPy's .std(), as taught. Return:

  • "A" if player A's spread is smaller,
  • "B" if player B's spread is smaller,
  • "tie" if the two spreads are equal when both are rounded to 4 decimal places.

Each player has at least one score. A single score has a spread of 0. The two players may have played different numbers of games.

Examples

scores_a = [78, 79, 80, 79]
scores_b = [55, 95, 100, 66]
returns 'A'
scores_a = [0, 5, 5, 5, 5, 10]
scores_b = [2, 2, 2, 8, 8, 8]
returns 'A'

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