GeorgiLukanov87

grades

Apr 15th, 2022 (edited)
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. all_students = int(input())
  2. grade1 = 0
  3. grade2 = 0
  4. grade3 = 0
  5. grade4 = 0
  6. total_grade = 0
  7. for student in range(1,all_students+1):
  8.     current_grade = float(input())
  9.     total_grade += current_grade
  10.     if current_grade >= 5:
  11.         grade1 += 1
  12.     elif current_grade >= 4 and current_grade <= 4.99:
  13.         grade2 += 1
  14.     elif current_grade >= 3 and current_grade <= 3.99:
  15.         grade3 += 1
  16.     else:
  17.         grade4 += 1
  18. print(f"Top students: {grade1/all_students*100:.2f}%")
  19. print(f"Between 4.00 and 4.99: {grade2/all_students*100:.2f}%")
  20. print(f"Between 3.00 and 3.99: {grade3/all_students*100:.2f}%")
  21. print(f"Fail: {grade4/all_students*100:.2f}%")
  22. print(f"Average: {total_grade/all_students:.2f}")
  23.  
Add Comment
Please, Sign In to add comment