Yanam

email_validator

Dec 12th, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.98 KB | None | 0 0
  1. email = input()
  2.  
  3. while True:
  4.     data = input()
  5.     if data == 'Complete':
  6.         break
  7.     data = data.split()
  8.     command = data[0]
  9.  
  10.     if command == 'Make':
  11.         command_2 = data[1]
  12.         if command_2 == 'Upper':
  13.             email = email.upper()
  14.             print(email)
  15.         elif command_2 == 'Lower':
  16.             email = email.lower()
  17.             print(email)
  18.     elif command == 'GetDomain':
  19.         last = int(data[1])
  20.         domain = email[-last:]
  21.         print(domain)
  22.     elif command == 'GetUsername':
  23.         if '@' in email:
  24.             symbol = email.index('@')
  25.             user = email[:symbol]
  26.             print(user)
  27.         else:
  28.             print(f'The email {email} doesn\'t contain the @ symbol.')
  29.     elif command == 'Replace':
  30.         char = data[1]
  31.         email = email.replace(char, '-')
  32.         print(email)
  33.     elif command == 'Encrypt':
  34.         new = [str(ord(letter)) for letter in email]
  35.         print(f'{" ".join(new)}')
Advertisement
Add Comment
Please, Sign In to add comment