总结:
排序 A.sort() 降序排A.sort(reverse=True)
最大值 max() 最小值 min()
求和sum()
平均值=sum()/len()
通用模板:
i=0
student_scores=[]
while i<6:
score=int(input())
student_scores.append(score)
i=i+1


i = 0
scores = [] # 定义空列表
while i<6 : # 在这里写循环成立的条件
score = int(input()) # 在这里通过 input() 函数获取输入的数据
scores.append(score) # 在这里将 score 添加至 scores 列表中
i+=1 # 不要忘了控制 i 的值哦
print(scores)


另一种算法(直接用sum()和len()求和和求平均值:
i=0
student_scores=[]
while i<6:
score=int(input())
student_scores.append(score)
i=i+1
total=sum(student_scores)
average=total/len(student_scores)
print(total)
print(average)








892

被折叠的 条评论
为什么被折叠?



