Sichanov

gg

Jul 17th, 2021 (edited)
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. total_bad_grades = int(input())
  2. command = input()
  3. number_grades = 0
  4. bad_grades = 0
  5. sum_grade = 0
  6. task_name = ''
  7.  
  8. while command != 'Enough':
  9.     task_name = command
  10.     grade = int(input())
  11.     number_grades += 1
  12.     if grade <= 4:
  13.         bad_grades += 1
  14.         if bad_grades == total_bad_grades:
  15.             break
  16.     sum_grade += grade
  17.     command = input()
  18.  
  19.  
  20. if bad_grades == total_bad_grades:
  21.     print(f"You need a break, {bad_grades} poor grades.")
  22. else:
  23.     average_grade = sum_grade / number_grades
  24.     print(f'Average score: {average_grade:.2f}')
  25.     print(f"Number of problems: {number_grades}")
  26.     print(f"Last problem: {task_name}")
  27.  
Add Comment
Please, Sign In to add comment