-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ3.py
More file actions
38 lines (28 loc) · 920 Bytes
/
Q3.py
File metadata and controls
38 lines (28 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import re
def email(e):
e = str(e)
for i in e:
if i.isalnum() == False and i not in ["@",".","-","_"]:
print("Invalid Email!")
break
if "@" not in e:
print("invalid email!")
else:
i = e.index("@")
if " " in e[:i] or e[i:].count(".") > 2 or e[i:].count(".") < 1:
print("Invalid email!")
else:
if e[i:].count(".") == 1:
j = e[i:].index(".")
if len(e[i:][j+1:]) != 3:
print("iNvalid email!")
else:
print("valid email !")
elif e[i:].count(".") == 2:
j = e[::-1].index(".")
if len(e[:j]) != 2:
print("invAlid email!")
else:
print("valid email !")
q = input("Enter email : ")
email(q)