Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- people = {}
- def check_input(lst: list, num: int):
- return len(lst) >= num
- for _ in range(n):
- command = input().split()
- cmd = command[0]
- if cmd == 'register' and check_input(command, 3):
- name = command[1]
- plate = command[2]
- if name in people:
- print(f'ERROR: already registered with plate number {people[name]}')
- else:
- people[name] = plate
- print(f'{name} registered {plate} successfully')
- elif cmd == 'unregister' and check_input(command, 2):
- name = command[1]
- if name not in people:
- print(f'ERROR: user {name} not found')
- else:
- print(f'{name} unregistered successfully')
- del people[name]
- [print(f'{x} => {y}') for (x, y) in people.items()]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement