Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- parts = input().split('|')
- while True:
- command = input()
- if command == 'Done':
- break
- else:
- tokens = command.split(' ')
- cmd = tokens[0]
- if cmd == 'Move':
- direction = tokens[1]
- idx = int(tokens[2])
- if direction == 'Left':
- if 0 < idx < len(parts):
- parts.insert(idx - 1, parts.pop(idx))
- elif direction == 'Right':
- if len(parts) - 1 > idx >= 0:
- parts.insert(idx + 1, parts.pop(idx))
- if cmd == 'Check':
- typo = tokens[1]
- if typo == 'Even':
- print(' '.join([parts[x] for x in range(len(parts)) if x % 2 == 0]))
- elif typo == 'Odd':
- print(' '.join([parts[x] for x in range(len(parts)) if x % 2 != 0]))
- weapon = ''.join(parts)
- print(f'You crafted {weapon}!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement