Drop the Extremes

Python FundamentalsMedium+10 XP+10

Drop the Extremes

In a gymnastics contest, the highest and lowest judge scores are thrown out. The rest are added up.

Task: write trimmed_total(scores) that returns the sum of all scores except one highest and one lowest.

  • Only one copy is dropped at each end. In [7, 9, 9, 6] you drop one 9 and the 6, leaving 7 + 9 = 16.
  • scores always has at least three values.

Examples

scores = [8, 6, 9, 7]
returns 15
scores = [7, 9, 9, 6]
returns 16

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