【发布时间】:2020-05-02 14:17:54
【问题描述】:
students=int(input('How many students do you have?'))
tests=int(input('How many test for your module?'))
for i in range(students):
i=i + 1
print('******* Student # {:0d} *******'.format(i))
while tests>0:
for t in range(tests):
t=t+1
total=int(input('test number {:0d}:'.format(t)))
break
average = total/tests
print('the average for student # {:0.0f} is {:0.1f}'.format(i,average))
如您所见,我在获取平均值时遇到了问题,因为总分只取最终测试分数,而不是总分
【问题讨论】:
标签: python-3.x int nested-loops