Advertisement
HristoBaychev

Exam Preparation

Feb 5th, 2023
689
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. number_wrong_task = int(input())
  2. total_sum = 0
  3. average = 0
  4. number_task = 0
  5. fail = 0
  6. last_name = ''
  7.  
  8. while True:
  9.  
  10.     task = input()
  11.     if task == 'Enough':
  12.         break
  13.     evaluation = int(input())
  14.     number_task += 1
  15.     total_sum += evaluation
  16.     last_name = task
  17.     if 2 <= evaluation <= 4:
  18.         fail += 1
  19.     if fail == number_wrong_task:
  20.         break
  21.  
  22. average = total_sum / number_task
  23. if task == 'Enough':
  24.     task = last_name
  25.     print(f'Average score: {average:.2f}')
  26.     print(f'Number of problems: {number_task:.0f}')
  27.     print(f'Last problem: {task}')
  28. else:
  29.     print(f'You need a break, {fail} poor grades.')
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement