Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- password = input()
- command = input()
- while command != "Done":
- command = command.split()
- action = command[0]
- if action == "TakeOdd":
- new_password = ''
- for current_index in range(len(password)):
- if not current_index % 2 == 0:
- new_password += password[current_index]
- password = new_password
- print(password)
- elif action == "Cut":
- index = int(command[1])
- length = int(command[2])
- part_for_cut = password[index:index + length]
- password = password.replace(part_for_cut, "", 1)
- print(password)
- elif action == "Substitute":
- substring = command[1]
- substitute = command[2]
- if substring in password:
- password = password.replace(substring, substitute)
- 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