close
def t12():
li=[]
inscore=0
i=1
while inscore!='-1':
inscore=input("請輸入第"+str(i)+"位學生成績(或輸入-1離開):")
if inscore.isdigit()==True and inscore!='-1':
if int(inscore)<=100 and int(inscore)>=0:
li.append(int(inscore))
i+=1
print("共有學生",len(li),"\n全班總分:",sum(li),"\n全班平均:","{0:4.2f}".format(sum(li)/len(li)),"\n最高分是:",max(li),"\n最低分是:",min(li))
全站熱搜
留言列表