Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- chat_history = []
- command = input().split()
- while not command[0] == 'end':
- action = command[0]
- if action == 'Chat':
- chat_history.append(command[1])
- elif action == 'Delete':
- message = command[1]
- if message in chat_history:
- chat_history.remove(message)
- elif action == 'Edit':
- message = command[1]
- edited_version = command[2]
- if message in chat_history:
- chat_history[chat_history.index(message)] = edited_version
- elif action == 'Pin':
- message = command[1]
- if message in chat_history:
- chat_history.append(chat_history.pop(chat_history.index(message)))
- elif action == 'Spam':
- messages = command
- for i in range(len(command)):
- if not messages[i] == 'Spam':
- chat_history.append(messages[i])
- command = input().split()
- print('\n'.join(chat_history))
Advertisement
Add Comment
Please, Sign In to add comment