Advertisement
ivanovan

Untitled

Feb 28th, 2020
632
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.12 KB | None | 0 0
  1. text = input()
  2.  
  3. while True:
  4.     command = input()
  5.     res=''
  6.     if command == 'For Azeroth':
  7.         break
  8.     if 'GladiatorStance' in command:
  9.         text = text.upper()
  10.         res=text
  11.     elif 'DefensiveStance' in command:
  12.         text = text.lower()
  13.         res=text
  14.     elif 'Dispel' in command:
  15.         args = command.split()
  16.         idx = int(args[1])
  17.         if 0 <= idx < len(text):
  18.             letter = args[2]
  19.             text = text[:idx] + letter + text[idx + 1:]
  20.             res='Success!'
  21.         else:
  22.             res='Dispel too weak.'
  23.  
  24.     elif 'Target' in command:
  25.         args = command.split()
  26.         if args[0] == 'Target':
  27.             type_ = args[1]
  28.             if type_ == 'Change':
  29.                 old = args[2]
  30.                 new = args[3]
  31.                 if old in text:
  32.                     text = text.replace(old, new)
  33.                     res=text
  34.             elif type_ == 'Remove':
  35.                 to_remove = args[2]
  36.                 text = text.replace(to_remove, '')
  37.                 res=text
  38.     if res:
  39.         print(res)
  40.     else:
  41.         print("Command doesn't exist!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement