【发布时间】:2021-02-17 20:30:53
【问题描述】:
编写一个 Python 程序,它可以存储学生的姓名和他们的考试成绩。该程序应该能够:
- 输入学生姓名和分数后,计算学生的平均分数并打印平均分数。
- 总结谁获得最高和最低。
我不知道如何找到平均值、最高和最低,这是我的代码:
students = {}
polling_active = True
while polling_active:
name = input("enter your name: ")
score = int(input("enter your score: "))
students[name] = score
repeat = input("would you like to add another student?" "(yes/no)")
if repeat == 'no':
polling_active = False
print ("-------RESULT-------")
for name, score in students.items():
print(name, "your score is: ", score )
total_sum = float(sum(score))
print (total_sum)
【问题讨论】:
-
您好,简单的语言,您可以在这里发布您的编程问题。问完整的解决方案不是一个好主意。
-
请不要指望人们会为您完成所有工作。这不是 stackexchange 的用途。向我们展示您的尝试以及您面临的问题。在那里,人们会提供帮助。
-
哦,对不起,我忘了提到我的工作,我已经编辑了帖子
标签: python variable-assignment