Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email_validation #826

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
33 changes: 33 additions & 0 deletions Email_validator/email_validation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
email = input("Enter your Email : ") # minimum charecter = [email protected] (i.e 6 charecters)
k,j,d=0,0,0
if len(email)>=6:
if email[0].isalpha(): # first letter of the email should be an alphabet
if ("@" in email) and (email.count("@")==1): # @ should be present in email and only once
if (email[-4]==".") ^ (email[-3]=="."): # . should be at 3rd position from last in .in and 4th position from last in .com .. here we use ^(XOR) operator because it might be possible that someone writes ..in . in that case if or operator is used it will show correct but in reality it is wrong
for i in email:
if (i==i.isspace()): # our email should not contain spaces
k=1
elif i.isalpha():
if i.isupper():
j=1
elif i.isdigit(): # email should not contain digits
continue
elif i=="_" or i=="." or i=="@":
continue
else:
d=1
if k==1 or j==1 or d==1:
print("Cookie says Email should not contain spaces and should not contain uppercase letters and should not contain any other alphanumeric charecters")
else:
print("Cookie Says Right Email")
else:
print("Cookie says position of . is invalid")
else:
print("Cookie says @ should be present only once in email")
else:
print("Cookie says First letter of the email should be an alphabet")

else:
print("Cookie says Email length too short")


17 changes: 17 additions & 0 deletions Email_validator/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<h1>Email Validation Using Python</h1>
<p><span style="font-size: medium;">Write a Python programme to determine whether or not a string is a valid email address.</span></p>
<p><span style="font-size: medium;">A string (a subset of ASCII characters) divided into two parts by the @ symbol, a "personal info" and a domain, personal info@domain, is an email.</span></p>
<h2> Valid Email </h2>

![yes](https://user-images.githubusercontent.com/74130928/167269169-8230d9e3-9be4-497c-a16e-9d23beb7a238.png)

<h2> Not Valid Email </h2>

![no](https://user-images.githubusercontent.com/74130928/167269201-c2714982-de6a-4eeb-8519-dad6228ca827.png)

<h2> Download Python </h2>
<a href="url">https://www.python.org/downloads/</a>



![pythondwnld](https://user-images.githubusercontent.com/74130928/167269348-446894aa-6a27-4bee-9886-4285fce6ff9c.png)