Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string = input().split("|")
- command = input()
- odd = []
- even = []
- if_odd = True
- if_even = True
- while command != 'Done':
- if 'Left' in command:
- tokens = command.split()
- move = int(tokens[2])
- if move > len(string):
- pass
- elif move == 0:
- pass
- else:
- string[move], string[move - 1] = string[move - 1], string[move]
- elif 'Right' in command:
- tokens = command.split()
- move = int(tokens[2])
- if move >= len(string):
- pass
- else:
- string[move], string[move + 1] = string[move + 1], string[move]
- elif 'Odd' in command:
- for i, x in enumerate(string):
- if i % 2 != 0:
- odd.append(x)
- elif 'Odd' not in command:
- if_odd = False
- elif 'Even' in command:
- for i, x in enumerate(string):
- if i % 2 == 0:
- even.append(x)
- elif 'Even' not in command:
- if_even = False
- command = input()
- if if_odd:
- print(' '.join(odd))
- if if_even:
- print(' '.join(even))
- final = ''.join(string)
- print(f'You crafted {final}!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement