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