Advertisement
bl00dt3ars

02. Exam Preparation

Oct 31st, 2020
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. fails = int(input())
  2.  
  3. total_score = 0
  4. tasks = 0
  5. fails_counter = 0
  6. last_task = ""
  7. has_failed = True
  8.  
  9. while fails_counter < fails:
  10.   task_name = input()
  11.   if task_name == "Enough":
  12.     has_failed = False
  13.     break
  14.  
  15.   score = int(input())
  16.   if score <= 4:
  17.     fails_counter += 1
  18.   total_score += score
  19.   tasks += 1
  20.   last_task = task_name
  21.  
  22. if has_failed:
  23.   print(f"You need a break, {fails} poor grades.")
  24. else:
  25.   print(f"Average score: {total_score / tasks:.2f}")
  26.   print(f"Number of problems: {tasks}")
  27.   print(f"Last problem: {last_task}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement