Sichanov

ss

Feb 7th, 2021
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. num_unsatisfactory_grade = int(input())
  2. question_count = 0
  3. grade_sum = 0
  4. current_unsatisfactory_grades = 0
  5. last_question = " "
  6. current_question_name = input()
  7.  
  8. while current_question_name != "Enough":
  9.     question_grade = int(input())
  10.     question_count += 1
  11.     grade_sum += question_grade
  12.     last_question = current_question_name
  13.     if question_grade <= 4:
  14.         current_unsatisfactory_grades += 1
  15.         if current_unsatisfactory_grades >= num_unsatisfactory_grade:
  16.             print(f"You need a break, {current_unsatisfactory_grades} poor grades.")
  17.             break
  18.     current_question_name = input()
  19.  
  20. if current_question_name == 'Enough':
  21.     print(f"Average score: {(grade_sum / question_count):.2f}")
  22.     print(f"Number of problems: {question_count}")
  23.     print(f"Last problem: {last_question}")
Advertisement
Add Comment
Please, Sign In to add comment