Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- information = {}
- command = input()
- while not command == 'Log out':
- command = command.split(': ')
- if command[0] == 'New follower':
- if command[1] not in information:
- information[command[1]] = 0
- elif command[0] == 'Like':
- if command[1] not in information:
- information[command[1]] = int(command[2])
- else:
- information[command[1]] += int(command[2])
- elif command[0] == 'Comment':
- if command[1] not in information:
- information[command[1]] = 1
- else:
- information[command[1]] += 1
- elif command[0] == 'Blocked':
- if command[1] not in information:
- print(f"{command[1]} doesn't exist.")
- else:
- information.pop(command[1])
- command = input()
- print(f'{len(information)} followers')
- for k, v in sorted(information.items(), key=lambda kvp: (-kvp[1], kvp)):
- print(f'{k}: {v}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement