Advertisement
Spocoman

02. Exam Preparation

Dec 27th, 2021 (edited)
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. score_break = int(input())
  2. poor_grades = 0
  3. last_name = ''
  4. counter = 0
  5. average = 0
  6.  
  7. while True:
  8.     name = input()
  9.     if name == "Enough":
  10.         print(f'Average score: {average / counter:.2f}')
  11.         print(f'Number of problems: {counter}')
  12.         print(f'Last problem: {last_name}')
  13.         break
  14.  
  15.     score = int(input())
  16.     if score > 4:
  17.         last_name = name
  18.     else:
  19.         poor_grades += 1
  20.     average += score
  21.     counter += 1
  22.  
  23.     if poor_grades == score_break:
  24.         print(f'You need a break, {poor_grades} poor grades.')
  25.         break
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement