Problem 156479 · medium · Level 01 Prerequisites & Setup

Drop the Highest and Lowest Score

lists · remove · min-by-hand

In a diving competition, one highest and one lowest judge's score are discarded before the rest are counted. Write drop_high_low(scores) that returns a new list with one occurrence of the highest score and one occurrence of the lowest score removed, keeping the remaining scores in their original order. If there are fewer than 3 scores, return an empty list.

Examples

Input:  scores = [7, 9, 4, 8, 10]
Output: [7, 9, 8]

Input:  scores = [5, 5]
Output: []

Goals

  • Find the largest and smallest values
  • Remove exactly one copy of each while keeping the order
Starting Python…