Programming , The elements indexed by even bits in the list ( The inclusion index is 0 The elements of ) Sort in ascending order , And put the sorted results back into the original list . Write the procedure as a function , The parameters are list .
Use input() Function input list .
Output the sorted list
[2,3,8,1,5,0,3,9]
[2, 3, 3, 1, 5, 0, 8, 9]
a=eval(input()) a[::2] = sorted(a[::2]) print(a)
Enter a list of integers a, And enter an integer x, Delete all values in the list as x Number of numbers , Then output the list
The first line is the input list In the second line, enter the integer to delete
Output the deleted list
5,3,8,98,3,87,3,3,2 3
[5, 8, 98, 87, 2]
a=list(map(eval,input().split(","))) b=eval(input()) c=[] for i in range(0,len(a)): if a[i]!=b: c.append(a[i]) print(c)
In gymnastics , The judges rate the contestants . The rule of scoring is to remove the highest score and the lowest score , Then calculate the average score , Please program the score of a player .
The first 1 Line contains an integer n (2<n<100), The number of judges , The first 2 Line inclusion n It's an integer , Express n The scores of the judges . Each integer is separated by a space .
Output player's score , The result is reserved 2 Decimal place .
4 100 99 98 97
98.50
a=eval(input()) b=list(map(eval,input().split(" "))) b.sort() print("{:.2f}".format(sum(b[1:-1])/(a-2)))