Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- password_use = input()
- line = input()
- while not line == "Sign up":
- commands = line.split()
- command = commands[0]
- if command == "Case":
- if commands[1] == "lower":
- password_use = password_use.lower()
- print(password_use)
- elif commands[1] == "upper":
- password_use = password_use.upper()
- print(password_use)
- elif command == "Reverse":
- startIndex = int(commands[1])
- endIndex = int(commands[2])
- if 0 <= startIndex <= endIndex < len(password_use):
- reversed_str = ''.join(reversed(password_use[startIndex:endIndex + 1]))
- print(reversed_str)
- elif command == "Cut":
- substring = commands[1]
- if substring in password_use:
- password_use = password_use.replace(substring, "")
- print(password_use)
- else:
- print(f"The word {password_use} doesn't contain {substring}.")
- elif command == "Replace":
- char = commands[1]
- password_use = password_use.replace(char, "*")
- print(password_use)
- elif command == "Check":
- new_char = commands[1]
- if new_char in password_use:
- print("Valid")
- else:
- print(f"Your username must contain {new_char}.")
- line = input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement