Advertisement
Guest User

Untitled

a guest
Sep 24th, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. string = input()
  2.  
  3. while True:
  4. command = input()
  5. if command == 'End':
  6. break
  7. args = command.split(' ')
  8. action = args[0]
  9. if action == 'Translate':
  10. char = args[1]
  11. replacement = args[2]
  12. string = string.replace(char, replacement)
  13. print(string)
  14. elif action == 'Includes':
  15. substring = args[1]
  16. print(substring in string)
  17. elif action == 'Start':
  18. substring = args[1]
  19. print(string.startswith(substring))
  20. elif action == 'Lowercase':
  21. string = string[::].lower()
  22. print(string)
  23. elif action == 'FindIndex':
  24. char = args[1]
  25. print(string.rindex(char))
  26. elif action == 'Remove':
  27. start_index = int(args[1])
  28. count = int(args[2])
  29. string = string[start_index + count:]
  30. print(string)
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement