Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- command = input()
- stats = {}
- while command != "Statistics":
- current_command = command.split("->")[0]
- username = command.split("->")[1]
- if current_command == "Add":
- if username not in stats:
- stats[username] = []
- else:
- print(f'{username} is already registered')
- elif current_command == "Send":
- email = command.split("->")[2]
- stats[username].append(email)
- elif current_command == "Delete":
- if username in stats:
- del stats[username]
- else:
- print(f'{username} not found!')
- command = input()
- stats = dict(sorted(stats.items(), key=lambda x: (-len(x[1]), x[0])))
- print(f'Users count: {len(stats)}')
- for key, value_list in stats.items():
- print(key)
- for email in value_list:
- print(f' - {email}')
Advertisement
Add Comment
Please, Sign In to add comment