九九八十一
发表于 2018-12-13 10:48:07
def fun219(*arg):
l = list(arg)
l.sort()
l = l
return sum(l)/len(l)
print(fun219(95, 33, 72, 88, 98, 45, 66, 72))
776667
发表于 2018-12-13 10:50:51
def fun219(*x):
return sum()/(len(x)-2)
幻千城12
发表于 2018-12-13 12:18:55
def fun219(*scores):
scores =
return sum(scores)/len(scores)
hcslzyc
发表于 2018-12-13 14:11:26
def fun(*a):
max=min=a
sum=0
for each in a:
sum+=each
if each>max:
max=each
if each<min:
min=each
return (sum-min-max)/(len(a)-2)
爱学习的喵
发表于 2018-12-13 15:20:04
本帖最后由 爱学习的喵 于 2018-12-13 15:23 编辑
def func219(*numbers):
array = list(numbers)
array.sort()
return sum(array) / (len(array)-2)
if __name__ == '__main__':
print(func219(95, 33, 72, 88, 98, 45, 66, 72))
#能想到最短的解决方法
罗同学
发表于 2018-12-13 16:36:07
def fun219(*point):
point=list(point)
point=sorted(point)
del point
del point[-1]
total=0
for i in point:
total+=i
number=len(point)
ave=total/number
return ave
==================== RESTART: 219.py ====================
>>> fun219(95, 33, 72, 88, 98, 45, 66, 72)
73.0
学学看看
发表于 2018-12-13 20:08:32
undi
发表于 2018-12-14 15:59:52
def fun219(*par):
print('The number of scores were: %d' %len(par))
count = 0
for each in par:
count += each
return (count-max(par)-min(par)) / (len(par)-2)
px204
发表于 2018-12-14 20:54:26
def fun219(*arg):
sum = 0
for e in arg:
sum = e + sum
average = (sum - min(arg) - max(arg)) / (len(arg)-2)
return average
print(fun219(95, 33, 72, 88, 98, 45, 66, 72))
stonejianbu
发表于 2018-12-14 22:58:44
def fun219(*args):
return sum()/(len(args)-2)
JessiFly
发表于 2018-12-15 11:55:18
def fun219(*scores):
list_s = list(scores)
list_s.pop(list_s.index(max(list_s)))
list_s.pop(list_s.index(min(list_s)))
total = 0
for each in list_s:
total += each
return total/len(list_s)
if __name__ == '__main__':
print('平均分是: %.1f' % fun219(95, 33, 72, 88, 98, 45, 66, 72) )
jeremyee123
发表于 2018-12-15 14:41:54
import random
list1=range(70,100)
list2=random.sample(list1,5)
list4=list2[:]
list2.remove(max(list2))
list2.remove(min(list2))
list3=list2
a=float(sum(list3))/float(len(list3))
print('%.2f' % a)
print(list2)
print(list4)
黑色的小白
发表于 2018-12-15 15:59:34
def fun219(*v):
ls = []
for j in v:
ls.append(j)
ls.sort()
ls = ls
num = 0
for i in ls:
num += i
result = num/len(ls)
return result
lzqi
发表于 2018-12-15 18:52:50
def fun219(*par)
m=max(*par)
n=min(*par)
mean=(*par-m-n)/length(*par-m-n)
return mean
指头比思想慢
发表于 2018-12-16 13:07:23
有段时间没写了,参与一下
def fun219(*v):
count = 0
sum_i = 0
num1 = v
num2 = v
for i in v:
if i >= num1:
num1 = i
if i <=num2:
num2 = i
sum_i += i
count += 1
return (sum_i - num1 - num2)/(count-2)
fun219(6,8,1,2,3,4,5,12,4,66.6)
wwyy
发表于 2018-12-16 22:26:06
def fun219():
a = input('请输入评分,以逗号隔开:')
b = a.split(',')
for i in range(0,len(b)):
b=int(b)
b.sort()
total = 0
for i in range(1,len(b)-1):
total = total + b
average = total / (len(b)-2)
print('%.2f'%average)
此人
发表于 2018-12-17 09:15:00
def fun219(*shu):
l = list(shu)
l.remove(max(l))
l.remove(min(l))
a = 0
b = 0
for i in l:
a += i
b += 1
return a / b
calton007
发表于 2018-12-17 10:42:03
def fun219(*scores):
s = list(scores)
s.sort()
s = s
return sum(s)/len(s)
heidern0612
发表于 2018-12-17 18:24:08
本帖最后由 heidern0612 于 2018-12-19 20:05 编辑
def scores (*score):
list1= []
for i in score:
list1.append(i)
list1.sort,list1.pop(0),list1.pop #排序,弹出首、尾元素
gal = sum (list1)
final_scores =round(gal/len(list1),1)
return final_scores
print(scores(95,33,72,88,98,45,66,72))
TCY
发表于 2018-12-18 12:01:43
本帖最后由 TCY 于 2018-12-18 13:24 编辑
def fun219(*nums):
nums = list(nums)
nums.remove(max(nums))
nums.remove(min(nums))
return sum(nums) / len(nums)