kostovhg

Untitled

Jul 16th, 2021
1,090
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. end_com = 'exam finished'
  2. line = input()
  3. submissions = {}
  4. users = {}
  5.  
  6. while line != end_com:
  7.     args = line.split('-')
  8.     if args[1] == 'banned':
  9.         if users.get(args[0]):
  10.             del users[args[0]]
  11.     else:
  12.         submissions.setdefault(args[1], []).append(int(args[2]))
  13.         users.setdefault(args[0], []).append(int(args[2]))
  14.  
  15.     line = input()
  16.  
  17. print("Results:")
  18. [print(f"{k} | {max(v)}") for k, v in sorted(users.items(), key=lambda x: (-max(x[1]), x[0]))]
  19. print("Submissions:")
  20. [print(f"{k} - {len(v)}") for k, v in sorted(submissions.items(), key=lambda x: (-len(x[1]), x[0]))]
  21.  
RAW Paste Data