Enter the number of student achievement, grade point average is calculated, and the statistical number of students failing.
Input formats:
Each line of input data, the input data is the 负数
end of the input
Output formats:
平均分=XX,不及格人数=XX
Which XX
indicates that the corresponding data. If there is no student data, output没有学生
Sample input:
30
50
70
80
90
20
-1
Sample output:
平均分=56.67,不及格人数=3
a = float(input()) list = [] sum = a list.append(a) count = 1 if a >= 0: while 1: a = float(input()) if a < 0: break list.append(a) sum = a + sum count = count + 1 print("平均分={:.2f},不及格人数=".format(sum / count), end="") n = 0 for i in list: if i < (sum / count): n = n + 1 print("%d" % n) else : print("没有学生")