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