Advertisement
veronikaaa86

02. Exam Preparation

Mar 27th, 2022
527
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. poor_grades = int(input())
  2.  
  3. sum_grades = 0
  4. count_grades = 0
  5. last_problem = ""
  6. count_poor_grades = 0
  7. has_failed = False
  8. input_line = input()
  9. while input_line != "Enough":
  10. grade = int(input())
  11. if grade <= 4:
  12. count_poor_grades += 1
  13.  
  14. last_problem = input_line
  15. count_grades = count_grades + 1
  16. sum_grades = sum_grades + grade
  17.  
  18. if poor_grades == count_poor_grades:
  19. has_failed = True
  20. break
  21. input_line = input()
  22.  
  23. if has_failed:
  24. print(f"You need a break, {count_poor_grades} poor grades.")
  25. else:
  26. avg_grades = sum_grades / count_grades
  27. print(f"Average score: {avg_grades:.2f}")
  28. print(f"Number of problems: {count_grades}")
  29. print(f"Last problem: {last_problem}")
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement