Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- some_string = input()
- command_data = input().split()
- while True:
- command = command_data[0]
- if command == "End":
- break
- if command == "Translate":
- char = command_data[1]
- replacement = command_data[2]
- some_string = some_string.replace(char, replacement)
- print(some_string)
- elif command == "Includes":
- substring = command_data[1]
- if substring in some_string:
- print("True")
- else:
- print("False")
- elif command == "Start":
- key_list = []
- start_string = command_data[1]
- match = False
- for i in range(len(start_string)):
- if start_string[i] == some_string[i]:
- match = True
- else:
- match = False
- break
- if match:
- print("True")
- else:
- print("False")
- elif command == "Lowercase":
- some_string = some_string.lower()
- print(some_string)
- elif command == "FindIndex":
- last_symbol = command_data[1]
- index = some_string.rfind(last_symbol)
- print(index)
- elif command == "Remove":
- start_index = int(command_data[1])
- num = int(command_data[2])
- some_list = [y for y in some_string]
- counter = 0
- for i in range(len(some_list)):
- if counter == num:
- break
- some_list.pop(start_index)
- counter += 1
- print("".join(some_list))
- command_data = input().split()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement