Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- test_password = input()
- password = test_password
- command = input()
- while command != "Done":
- command_part = command.split(" ")
- if command_part[0] == "TakeOdd":
- password = ''.join(password[i] for i in range(len(password)) if i % 2 != 0)
- print(password)
- elif command_part[0] == "Cut":
- index, length = int(command_part[1]), int(command_part[2])
- password = password[:index] + password[index + length:]
- print(password)
- elif command_part[0] == "Substitute":
- substring, substitute_text = command_part[1], command_part[2]
- if substring in password:
- password = password.replace(substring, substitute_text)
- print(password)
- else:
- print("Nothing to replace")
- command = input()
- print(f"Your password is: {password}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement