Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def generate_name(some_username):
- new_generated_username = []
- while True:
- command = input().split()
- if command[0] == 'Registration':
- # print(''.join(some_username))
- break
- if command[0] == 'Letters':
- if command[1] == 'Lower':
- some_username = some_username.lower()
- print(some_username)
- elif command[1] == 'Upper':
- some_username = some_username.upper()
- print(some_username)
- if command[0] == 'Reverse':
- start_index = int(command[1])
- end_index = int(command[2])
- substring = ''
- if 0 <= start_index <= len(some_username) and 0 <= end_index < len(some_username):
- substring = some_username[start_index:end_index + 1]
- print(substring[::-1])
- else:
- continue
- if command[0] == 'Substring':
- if command[1] in some_username:
- some_username = some_username.replace(command[1], '')
- print(some_username)
- else:
- print(f"The username {some_username} doesn't contain {command[1]}.")
- if command[0] == 'Replace':
- some_username = some_username.replace(command[1], '-')
- print(some_username)
- if command[0] == 'IsValid':
- if command[1] in some_username:
- print('Valid username.')
- else:
- print(f'{command[1]} must be contained in your username.')
- username = input()
- generate_name(username)
Advertisement
Add Comment
Please, Sign In to add comment