Skip to content

moeinebrahimzade89/Email-separation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Email Separation

A simple Python program that splits an email address into its username and domain parts.

Technologies Used

  • Python 3
  • input() and print()
  • String methods such as find()
  • String slicing
  • Basic conditional statements

Features

  • 📧 Accepts an email address from the user
  • 🔍 Checks whether the email contains @
  • ✂️ Extracts the username part before @
  • 🌐 Extracts the domain part after @
  • ⚠️ Shows an error message for invalid email input

Installation

  1. Make sure Python 3 is installed on your computer.
  2. Save the script as Email separation.py.
  3. Open a terminal or command prompt in the same folder.
  4. Run the program with:
python "Email separation.py"

Then enter an email address when prompted.

If the email contains @, the program prints the username and domain separately.

If not, it prints an error message.

Output

Sample Input

email: user@example.com

Sample Output

Username:user
Domain:example.com

Invalid Input

email: userexample.com

Invalid Output

Your email is incorrect.

Notes

  • ⚠️ This script only checks for the presence of @, so it does not fully validate email format.
  • 💡 It is useful for learning string handling and basic validation in Python.

About

This program takes the email, splits it into two parts: username and domain, and prints them in the output.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages