Advertisement
GeorgiLukanov87

01. The Imitation Game

Jul 2nd, 2022
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. # 01. The Imitation Game 100/100 Final_Exam_fundamentals_python
  2.  
  3. message = input()
  4. command = input()
  5.  
  6. while not command == "Decode":
  7.     command = command.split("|")
  8.     if command[0] == "ChangeAll":
  9.         substring = command[1]
  10.         replace = command[2]
  11.         message = message.replace(substring,replace)
  12.  
  13.     elif command[0] == "Insert":
  14.         index = int(command[1])
  15.         value = command[2]
  16.         message = message[:index] + value + message[index:]
  17.  
  18.     elif command[0] == 'Move':
  19.         num = int(command[1])
  20.         message = message[num:] + message[:num]
  21.  
  22.     command = input()
  23.  
  24. print(f"The decrypted message is: {message}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement