Advertisement
GeorgiLukanov87

12. SoftUni Exam Results 100/100

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