代码如下:
def getNum():
l=[]
a=input("请输入数据:")
while a!="":
l.append(int(a))
a=input("请输入数据:")
return l
def mean(l):
return sum(l)/len(l)
def dev(l):
avg=mean(l)
return (sum([(i-avg)**2 for i in l])/len(l)-1)**0.5
def mid(l):
l.sort()
L=l
l=len(L)
if l%2==0:
print(L[l//2])
print(L[l//2-1])
print('gggg',(L[l//2] + L[1//2-1]))
return (L[l//2]+L[1//2-1])/2
else:
return L[l//2]
def main():
m=getNum()
print(m)
n=dev(m)
print(n)
a=mid(m)
print(a)
main()
66+77=165?
我很懵