+ 3

# 38.2 Right decision. Python

The proposed solution excludes 1 maximum and 1 minimum, although there are 2 maximum "1024" in the array. Therefore, the proposed solution is wrong Decision data = [7, 5, 6.9, 1, 8, 42, 33, 128, 1024, 2, 8, 11, 0.4, 1024, 66, 809, 11, 8.9, 1.1, 3.42, 9, 100, 444, 78] a = data.count(max(data)) b = data.count(min(data)) total = 0 for x in data: total += x total = total - (max(data) * a + min(data) * b) print(totals)

29th Mar 2022, 11:32 AM
Ilya Samartsev
29th Mar 2022, 11:37 AM
Simba
+ 3
Task. Print the sum of all the array values except for all minimum and maximum values. The array that is given in the task has 1 minimum value (0.4) and 2 maximum values (1024) The proposed solution removes 1 maximum and 1 minimum, but the second maximum remains
29th Mar 2022, 11:51 AM
Ilya Samartsev
+ 3
Илья Самарцев So 0.4 is the min and 1024 is the max and it says remove "all" max and min values. Therefore, the one 0.4 and the two 1024 values should be removed.
29th Mar 2022, 12:02 PM