Advertisement
GeorgiLukanov87

12. SoftUni Exam Results 90/100

Jun 17th, 2022
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. command = input()
  2. data = {}
  3. all_languages = []
  4. while not command == 'exam finished':
  5.     command = command.split("-")
  6.     if command[1] == "banned":
  7.         name = command[0]
  8.         del data[name]
  9.         command = input()
  10.         continue
  11.     elif not command[1] == 'banned':
  12.         name = command[0]
  13.         language = command[1]
  14.         points = int(command[2])
  15.     if name not in data:
  16.         data[name] = points
  17.     else:
  18.         if points > data[name]:
  19.             data[name] = points
  20.  
  21.     all_languages += [language]
  22.     command = input()
  23.  
  24. print('Results:')
  25. for key, value in data.items():
  26.     print(f'{key} | {value}')
  27.  
  28. print('Submissions:')
  29. for subm in range(len(set(all_languages))):
  30.     final_copy = all_languages.copy()
  31.     result = sorted(list(set(all_languages)), reverse=True)
  32.     current_language = result[subm]
  33.     print(f"{result[subm]} - {final_copy.count(current_language)}")
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement