Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- user = input()
- len_user = len(user)
- command = input().split()
- new_string = user
- while command[0] != "Registration":
- if command[0] == 'Letters' and command[1] == 'Lower':
- user = user.lower()
- print(user)
- elif command[0] == 'Letters' and command[1] == 'Upper':
- user = user.upper()
- print(user)
- elif command[0] == 'Reverse':
- start = int(command[1])
- end = int(command[2])
- if 0 <= start < len_user and 0 < end < len_user and start < end:
- substring = user[start:end+1][::-1]
- print(substring)
- else:
- print("Invalid indices. Start and end must be within the username length.")
- elif command[0] == 'Substring':
- if command[1] not in new_string:
- print(f"The username {user} doesn't contain {command[1]}.")
- else:
- new_string = new_string.replace(command[1], '')
- print(new_string)
- elif command[0] == 'Replace':
- new_string = user.replace(command[1], '-')
- print(new_string)
- elif command[0] == 'IsValid':
- if command[1] in user:
- print("Valid username.")
- else:
- print(f"{command[1]} must be contained in your username.")
- command = input().split()
Advertisement
Add Comment
Please, Sign In to add comment