bl00dt3ars

1

Aug 15th, 2021
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.09 KB | None | 0 0
  1. username = input()
  2. command = input()
  3.  
  4. while not command == 'Sign up':
  5.     command = command.split()
  6.     if command[0] == 'Case':
  7.         if command[1] == 'lower':
  8.             username = username.lower()
  9.         elif command[1] == 'upper':
  10.             username = username.upper()
  11.         print(username)
  12.     elif command[0] == 'Reverse':
  13.         start_index = int(command[1])
  14.         end_index = int(command[2])
  15.         if start_index <= len(username) and end_index <= len(username):
  16.             print(username[start_index:end_index+1][::-1])
  17.     elif command[0] == 'Cut':
  18.         if command[1] in username:
  19.             username = username.replace(command[1], '')
  20.             print(username)
  21.         else:
  22.             print(f"The word {username} doesn't contain {command[1]}.")
  23.     elif command[0] == 'Replace':
  24.         username = username.replace(command[1], '*')
  25.         print(username)
  26.     elif command[0] == 'Check':
  27.         if command[1] in username:
  28.             print('Valid')
  29.         else:
  30.             print(f"Your username must contain {command[1]}.")
  31.  
  32.     command = input()
Advertisement
Add Comment
Please, Sign In to add comment