Advertisement
Spocoman

04. Grades

Dec 26th, 2021 (edited)
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. students = int(input())
  2. grade3 = 0
  3. grade4 = 0
  4. grade5 = 0
  5. grade6 = 0
  6. gradeSum = 0
  7.  
  8. for i in range(students):
  9.     grade = float(input())
  10.     if grade >= 5:
  11.         grade6 += 1
  12.     elif grade >= 4:
  13.         grade5 += 1
  14.     elif grade >= 3:
  15.         grade4 += 1
  16.     elif grade >= 2:
  17.         grade3 += 1
  18.  
  19.     gradeSum += grade
  20.  
  21. print(f'Top students: {(grade6 / students * 100):.2f}%')
  22. print(f'Between 4.00 and 4.99: {(grade5 / students * 100):.2f}%')
  23. print(f'Between 3.00 and 3.99: {(grade4 / students * 100):.2f}%')
  24. print(f'Fail: {(grade3 / students * 100):.2f}%')
  25. print(f'Average: {(gradeSum / students):.2f}')
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement