python弱鸡,后面不知怎样写,大佬帮帮我!

P5726 【深基4.习9】打分

EC75 @ 2021-11-28 10:02:02

n=int(input())
a=[]
for i in range(n):
    fenshu=float(input())
    a.append(fenshu)
a.pop(0)
a.pop()

by yuchenren @ 2021-11-28 10:06:19

求平均数:

sum = 0
for i in range(a.size):
    sum += a[i];
print(sum / a.size)

by yuchenren @ 2021-11-28 10:13:12

大概就是这样,这个 RE 了(


by EC75 @ 2021-11-28 10:38:16

@任宇宸 Thanks


by EC75 @ 2021-11-28 10:39:38

@任宇宸 是全都RE了


by tlm1587201497 @ 2022-08-25 12:00:09

@continue_and_break

a=int(input())
b=input().split()
for i in range(a):
    b[i]=int(b[i])
b.sort()
b.pop(0)
b.pop(a-2)
c=0
for i in range(a-2):
    c+=int(b[i])
c=c/(a-2)
print("%.2f"%c)

这应该可以


|