Sichanov

exam preparation

Apr 17th, 2021
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. failed_grades = int(input())
  2.  
  3. failed_times = 0
  4. number_solved_problems = 0
  5. grade_sum = 0
  6. last_problem = ''
  7. has_failed = True
  8.  
  9. while failed_times < failed_grades:
  10.     problem_name = input()
  11.     if problem_name == 'Enough':
  12.         has_failed = False
  13.         break
  14.     grade = int(input())
  15.     if grade <= 4:
  16.         failed_times += 1
  17.     grade_sum += grade
  18.     number_solved_problems += 1
  19.     last_problem = problem_name
  20. if has_failed:
  21.     print(f"You need a break, {failed_grades} poor grades.")
  22. else:
  23.     print(f"Average score: {grade_sum / number_solved_problems:.2f}")
  24.     print(f"Number of problems: {number_solved_problems}")
  25.     print(f"Last problem: {last_problem}")
Advertisement
Add Comment
Please, Sign In to add comment