python 3.3.3用python计算学生/班级平均值
我想为班级写一个程序,我迷路了。这是我需要做的。
我需要根据输入的成绩计算每个学生的平均水平。 我需要计算一个班的平均水平。 如果学生输入等级-1输入等级停止。 需要打印每个学生成绩的讯息。 学生成绩应显示数字成绩和字母成绩。 该信息将基于学生信等级。
我如何收集和储存学生姓名和考试成绩。 ,这样我就可以一次输出它,它会显示学生姓名。 他们的数字平均值,基于该平均值的字母等级, 和基于他们收到的字母等级的声明?
继承人的代码,我到目前为止:
def main():
another_student = 'y'
while another_student == 'y' or another_student == 'Y':
student_average()
print()
another_student = input('do you have another student to enter (y/n) ? ')
while another_student == 'n' or another_student == 'N':
student_average_list()
class_average()
break
def student_average():
total = 0.0
print()
student_name = input('what is the students name? ')
print()
print()
print(student_name)
print('-------------------')
number_of_tests = int(input('please enter the number of tests : '))
for test_num in range(number_of_tests):
print('test number', test_num + 1, end='')
score = float(input(': '))
total += score
student_average = total/number_of_tests
print()
print(student_name,"'s average is : ",student_average, sep='')
def student_average_list():
print ('kahdjskh')
def class_average():
print ('alsjd')
main()