Advertisement
veronikaaa86

02. Exam Preparation

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