Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- text = input()
- command = input()
- while not command == "Done":
- tokens = command.split()
- current_command = tokens[0]
- if current_command == "Change":
- char = tokens[1]
- replacement = tokens[2]
- text = text.replace(char, replacement)
- print(text)
- elif current_command == "Includes":
- result = tokens[1] in text
- print(result)
- elif current_command == "End":
- string = tokens[1]
- result = text.endswith(string)
- print(result)
- elif current_command == "Uppercase":
- text = text.upper()
- print(text)
- elif current_command == "FindIndex":
- char = tokens[1]
- index = text.index(char)
- print(index)
- elif current_command == "Cut":
- start_index = int(tokens[1])
- length = int(tokens[2])
- text = text[start_index:start_index+length]
- print(text)
- command = input()
Advertisement
Add Comment
Please, Sign In to add comment