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