Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. string = input().split("|")
  2. command = input()
  3.  
  4. while command != 'Done':
  5. if 'Left' in command:
  6. tokens = command.split()
  7. move = int(tokens[2])
  8. if move > len(string):
  9. pass
  10. elif move == 0:
  11. pass
  12. else:
  13. string[move], string[move - 1] = string[move - 1], string[move]
  14. elif 'Right' in command:
  15. tokens = command.split()
  16. move = int(tokens[2])
  17. if move >= len(string):
  18. pass
  19. else:
  20. string[move], string[move + 1] = string[move + 1], string[move]
  21.  
  22. elif 'Even' in command:
  23. print(' '.join(string[::2]))
  24.  
  25. elif 'Odd' in command:
  26. print(' '.join(string[1::2]))
  27.  
  28. command = input()
  29.  
  30. final = ''.join(string)
  31. print(f'You crafted {final}!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement