Home > other >  Dear bosses, can you help me
Dear bosses, can you help me

Time:09-20

In a game, a total of five judges to score, to calculate the players score, remove the highest and lowest points, then the average, the value is the player's score,

(hint: first define an empty list, and then through the for loop, element is added to the list to score in turn until the end of the five judges score all input loop, and then removed from the list with the maximum and minimum values, and finally by the sum () function sum and divided by the average number of elements,)



Requirements: (1) the use of combination type of operating functions and data processing method to complete the programming;

(2) the program needs to add annotations, indicating the functions of each line of code: Complete code of the program and its result upload screenshots,

CodePudding user response:

Arr=[]
For I in range (5) :
Arr. Append (int (input (" % s judges scoring: "% (I + 1)))) # cycle entry score
Arr. The sort order of the fraction () #
Print (" player final score: % 2 f "% (sum (arr (1:4))/(3)) # remove the highest and lowest points, calculate the average
  • Related