GroZnik81

1ва

Dec 13th, 2020
18
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. password_use = input()
  2.  
  3. line = input()
  4.  
  5. while not line == "Sign up":
  6. commands = line.split()
  7. command = commands[0]
  8.  
  9. if command == "Case":
  10. if commands[1] == "lower":
  11. password_use = password_use.lower()
  12. print(password_use)
  13. elif commands[1] == "upper":
  14. password_use = password_use.upper()
  15. print(password_use)
  16. elif command == "Reverse":
  17. startIndex = int(commands[1])
  18. endIndex = int(commands[2])
  19. if 0 <= startIndex <= endIndex < len(password_use):
  20. reversed_str = ''.join(reversed(password_use[startIndex:endIndex + 1]))
  21. print(reversed_str)
  22.  
  23. elif command == "Cut":
  24. substring = commands[1]
  25. if substring in password_use:
  26. password_use = password_use.replace(substring, "")
  27. print(password_use)
  28. else:
  29. print(f"The word {password_use} doesn't contain {substring}.")
  30.  
  31. elif command == "Replace":
  32. char = commands[1]
  33. password_use = password_use.replace(char, "*")
  34. print(password_use)
  35.  
  36. elif command == "Check":
  37. new_char = commands[1]
  38. if new_char in password_use:
  39. print("Valid")
  40. else:
  41. print(f"Your username must contain {new_char}.")
  42.  
  43. line = input()
RAW Paste Data