Advertisement
simeonshopov

Warirors Quest

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