Advertisement
horozov86

SoftUni Parking

Mar 20th, 2023
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. dictionary = {}
  2.  
  3. count = int(input())
  4.  
  5. for _ in range(count):
  6.     line = input()
  7.     line_split = line.split()
  8.     command = line_split[0]
  9.     name = line_split[1]
  10.  
  11.     if command == "register":
  12.         plate_number = line_split[2]
  13.         if name in dictionary:
  14.             print(f"ERROR: already registered with plate number {dictionary[name]}")
  15.         else:
  16.             dictionary[name] = plate_number
  17.             print(f"{name} registered {plate_number} successfully")
  18.  
  19.     else:
  20.         if name not in dictionary:
  21.             print(f"ERROR: user {name} not found")
  22.  
  23.         else:
  24.             dictionary.pop(name)
  25.             print(f"{name} unregistered successfully")
  26.  
  27. for name, plate_number in dictionary.items():
  28.     print(f"{name} => {plate_number}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement