Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/python3.7
- # -*- coding: utf-8 -*import
- text = input()
- while True:
- command = input()
- if command == 'Complete':
- break
- res = ''
- if command == 'GetUsername':
- if '@' in text:
- res = text[:text.index('@')]
- else:
- res = f"The email {text} doesn't contain the @ symbol."
- elif command == 'Encrypt':
- res = ' '.join([str(ord(x)) for x in text])
- else:
- args = command.split()
- cmd = args[0]
- if cmd == 'Make' and len(args) > 1:
- if args[1] == 'Upper':
- text = text.upper()
- res = text
- elif args[1] == 'Lower':
- text = text.lower()
- res = text
- elif cmd == 'GetDomain' and len(args) > 1:
- count = int(args[1])
- res = text[-count:]
- elif cmd == 'Replace':
- letter = args[1]
- if letter in text:
- res = text.replace(letter, '-')
- if res:
- print(res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement