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