-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathemailAddressSyntax.py
More file actions
39 lines (29 loc) · 942 Bytes
/
emailAddressSyntax.py
File metadata and controls
39 lines (29 loc) · 942 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
def emailSyntaxCheck(emailAddress):
flag = 0
while True:
if not '@' in emailAddress:
flag = -1
print('ERROR: Absence of \'@\'')
break
elif emailAddress[1] == '.' or emailAddress[-1] == '.':
print('ERROR: Email Address CAN\'T start/end with a \'.\' ')
flag = -1
break
elif not emailAddress[-4] == '.' or emailAddress[-3] == '.':
flag = -1
print('ERROR: Uncategorised Extension.')
break
elif '..' in emailAddress:
flag = -1
print('.. NOT allowed.')
break
else:
return True
if flag == -1:
return False
emailAddress = 'vipin.mca17.du@gmail.com'
boolValue = emailSyntaxCheck(emailAddress)
if boolValue == True:
print(emailAddress,'is syntactically valid.')
else:
print(emailAddress,'is NOT syntactically valid.')