Advertisement
Kamend1

kamen_dimitrov_SoftUni_Exam_Results

Oct 19th, 2023
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. exam_results = {}
  2.  
  3. user_command = input()
  4.  
  5. while user_command != "exam finished":
  6.  
  7. user_command = user_command.split("-")
  8.  
  9. if user_command[1] != "banned":
  10. if user_command[1] not in exam_results.keys():
  11. exam_results[user_command[1]] = {}
  12. if user_command[0] not in exam_results[user_command[1]]:
  13. exam_results[user_command[1]][user_command[0]] = []
  14. exam_results[user_command[1]][user_command[0]].append(user_command[2])
  15. else:
  16. for key, value in exam_results.items():
  17. if user_command[0] in value:
  18. exam_results[key][user_command[0]].pop()
  19. exam_results[key][user_command[0]].append("banned")
  20. user_command = input()
  21.  
  22. print("Results:")
  23. for language, names in exam_results.items():
  24. for name, score in names.items():
  25. if score[0] != "banned":
  26. print(f"{name} | {max(score)}")
  27.  
  28. print("Submissions:")
  29. for language, names in exam_results.items():
  30. submissions = 0
  31. for name, score in names.items():
  32. submissions += len(score)
  33. print(f"{language} - {submissions}")
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement