Advertisement
Nenogzar

SoftUni Exam Results

Mar 4th, 2024
989
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. university = {}
  2.  
  3. collect = input()
  4. while collect != "exam finished":
  5.     if "banned" in collect.split("-"):
  6.         username = collect.split("-")[0]
  7.         del university[language]["users"][username]
  8.     else:
  9.         username, language, points = collect.split("-")
  10.         if language not in university:
  11.             university[language] = {"count": 1, "users": {username: points}}
  12.         else:
  13.             university[language]["count"] += 1
  14.             if username not in university[language]["users"]:
  15.                 university[language]["users"][username] = points
  16.             else:
  17.                 if points > university[language]["users"][username]:
  18.                     university[language]["users"][username] = points
  19.  
  20.     collect = input()
  21.  
  22. print("Results:")
  23. for language, data in university.items():
  24.     for user, points in data["users"].items():
  25.         print(f"{user} | {points}")
  26.  
  27. print("Submissions:")
  28. for language, data in university.items():
  29.     print(f"{language} - {data['count']}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement