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()