bl00dt3ars

problem 2

Feb 27th, 2021 (edited)
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.08 KB | None | 0 0
  1. weapon_name = [el for el in input().split("|")]
  2.  
  3. command = input().split()
  4.  
  5. while "Done" not in command:
  6.     if "Move" in command:
  7.         index = int(command[2])
  8.         if "Right" in command:
  9.             if 0 <= index < len(weapon_name):
  10.                 weapon_name.insert(index + 2, weapon_name[index])
  11.                 weapon_name.remove(weapon_name[index])
  12.         elif "Left" in command:
  13.             if 0 < index <= len(weapon_name):
  14.                 weapon_name.insert(index - 1, weapon_name[index])
  15.                 weapon_name.pop(index + 1)
  16.     elif "Odd" in command:
  17.         odds = []
  18.         for i in range(len(weapon_name)):
  19.             if i % 2 == 1:
  20.                 odds.append(weapon_name[i])
  21.         odds = " ".join(odds)
  22.         print(odds)
  23.     elif "Even" in command:
  24.         evens = []
  25.         for i in range(len(weapon_name)):
  26.             if i % 2 == 0:
  27.                 evens.append(weapon_name[i])
  28.         evens = " ".join(evens)
  29.         print(evens)
  30.     command = input().split()
  31.  
  32. weapon_name = "".join(weapon_name)
  33. print(f"You crafted {weapon_name}!")
Add Comment
Please, Sign In to add comment