代码供参考:如有帮助请采纳下
index = 1 # 记录下学生序号,如第1个学生
num = int(input("请输入学生人数:"))
arry = [] # 记录学生的分数
while len(arry) < num:
score = int(input("请输入第%s学生成绩:" % index))
while score < 0 or score > 100:
print("成绩不是百分制,重新输入")
score = int(input("请再次输入第%s学生成绩:" % index))
arry.append(score) # 每次输入的分数记录下来
index += 1
avg_score = round(sum(arry) / num,2)
print("学生平均成绩:%s" % avg_score)