Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
29 changes: 29 additions & 0 deletions emailvalidator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
def validate_email(email):
email = email.strip().lower()

if email.count("@") != 1:
return False

username, domain = email.split("@")

if not username or not domain:
return False

if "." not in domain:
return False

if ".." in email:
return False

if domain.startswith(".") or domain.endswith("."):
return False

return True


email = input("Enter email: ")

if validate_email(email):
print("Valid email")
else:
print("Invalid email")