diff --git a/Email_validator/email_validation.py b/Email_validator/email_validation.py new file mode 100644 index 000000000..e2de496b2 --- /dev/null +++ b/Email_validator/email_validation.py @@ -0,0 +1,33 @@ +email = input("Enter your Email : ") # minimum charecter = a@b.in (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") + + diff --git a/Email_validator/readme.md b/Email_validator/readme.md new file mode 100644 index 000000000..88a67d94f --- /dev/null +++ b/Email_validator/readme.md @@ -0,0 +1,17 @@ +

Email Validation Using Python

+

Write a Python programme to determine whether or not a string is a valid email address.

+

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.

+

Valid Email

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

Not Valid Email

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

Download Python

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