python3.6代码:
cnt = 0sum = 0while True: print("请输入分数:") i = input() if(not i): continue if(i=="q"): break if(int(i)<0): print("输入有误!") continue cnt = cnt + 1 sum = sum + int(i)print("学生人数:" + str(cnt))print("平均分:" + str(sum/cnt))