统计一个班级学生的考试成绩,首先需要录入学生及其考试成绩。选出最高分,平均分,分数由高到低进行排序。评出学霸和学渣!
我的代码如下:
#!/usr/bin/env python
#coding:utf-8
#352-01.py
a=1
n1=raw_input("please input number of student:")
n=int(n1)
dd={}
while a<=n:
i=raw_input("please input student name:")
j=raw_input("please input score for %s:"% i)
dd[i]=j
a+=1
print"it is the message you input",dd
def ave(x):
x1=x.values()
s6=0
for o in x1:
s6=s6+int(o)
x3=len(x1)
x4=s6/x3
return x4
def shunxu(x):
y1=[]
for k in x:
y2=(x[k],k)
y1.append(y2)
y3=sorted(y1,reverse=True)
y5=[]
for k1 in y3:
y4=(k1[1],k1[0])
y5.append(y4)
return y5
d