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