Skip to content
Code ReadingDrop the Extremes
Break the Code

Drop the Extremes

Write a list for which this function gives the wrong answer.
1def trimmed_sum(values):
2 low = min(values)
3 high = max(values)
4 return sum(v for v in values if v != low and v != high)