Advertisement
BdW44222

Problem 1. Password Reset

Aug 10th, 2021
1,477
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. string_input = input()
  2.  
  3. data = input()
  4.  
  5. raw_password = " "
  6.  
  7. while not data == "Done":
  8.     command = data.split()[0]
  9.  
  10.     if command == "TakeOdd":
  11.         for index in range(len(string_input)):
  12.             if not index % 2 == 0:
  13.                 raw_password += string_input[index]
  14.         print(f"{raw_password}")
  15.  
  16.     elif command == "Cut":
  17.         index = int(data.split()[1])
  18.         length = int(data.split()[2])
  19.         left_side = raw_password[:index]
  20.         right_side = raw_password[index + length:]
  21.         raw_password = left_side + right_side
  22.  
  23.         print(f"{raw_password}")
  24.  
  25.  
  26.     elif command == "Substitute":
  27.         pass
  28.  
  29.     data = input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement