Blue Bridge Cup python group - score statistics

Blue Bridge Cup python group - score statistics

Topic description

Xiaolan organized an exam for the students, with a total score of 100 points, and each student's score was an integer from 0 to 100.

If the score is at least 60 points, it is called a pass. A score of at least 85 is considered excellent.

Please calculate the pass rate and the excellent rate, expressed as a percentage, and the part before the percent sign is rounded to the nearest whole number.

enter description

The first line of input contains an integer n\ (1 \leq n \leq 10^4)n (1≤n≤10
4
), which represents the number of exams.

The next nn lines, each containing an integer from 0 to 100, represent a student's score.

output description

Output two lines, each with a percentage, indicating the pass rate and the excellent rate respectively. The part before the percent sign is rounded to the nearest whole number.

insert image description here
Above code:

import os
import sys

n=int(input())
well=0
ok=0
for i in range(n):
    a=int(input())
    if a>=85:
        well+=1
        ok+=1
    elif a>=60:
        ok+=1
print("{}%".format(round(100*ok/n)))#round()对于浮点数进行四舍五入
print("{}%".format(round(100*well/n)))

Thank you for your support. Your one-click three-link is the biggest driving force for Ganggang students!
(The final page of the code, no love is god!)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324319725&siteId=291194637