├── README.md ├── code.py ├── email slicer.py ├── emailslicer.py ├── program.py └── slice.py /README.md: -------------------------------------------------------------------------------- 1 | # Email-Slicer-with-Python -------------------------------------------------------------------------------- /code.py: -------------------------------------------------------------------------------- 1 | email = input("Enter Your Email: ").strip() 2 | 3 | username = email[:email.index('@')] 4 | domain = email[email.index('@') + 1:] 5 | 6 | print(f"Your username is {username} & domain is {domain}") 7 | -------------------------------------------------------------------------------- /email slicer.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | def email_slicer(email): 5 | username, _, domain = email.strip().partition("@") 6 | return f"Your username is {username} & domain is {domain}" 7 | user_input = input("Enter Your Email: ") 8 | print(email_slicer(user_input)) 9 | -------------------------------------------------------------------------------- /emailslicer.py: -------------------------------------------------------------------------------- 1 | email_address = input(“enter your email address”).strip() 2 | new = email_address.partition(“@”) 3 | print(f”user name {new[0] } and {new[-1]}”) 4 | -------------------------------------------------------------------------------- /program.py: -------------------------------------------------------------------------------- 1 | email = input("Enter Your Email: ").strip() 2 | username = email[:email.index("@")] 3 | domain_name = email[email.index("@")+1:] 4 | format_ = (f"Your user name is '{username}' and your domain is '{domain_name}'") 5 | print(format_) 6 | -------------------------------------------------------------------------------- /slice.py: -------------------------------------------------------------------------------- 1 | # Get user email address 2 | email = input("What is your email address?: ").strip() 3 | 4 | # Slice out the user name 5 | user_name = email[:email.index("@")] 6 | 7 | # Slice the domain name 8 | domain_name = email[email.index("@")+1:] 9 | 10 | # Format message 11 | output = "Your username is '{}' and your domain name is '{}'".format(user_name,domain_name) 12 | 13 | # Display output message 14 | print(output) 15 | --------------------------------------------------------------------------------