-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmail Validator.py
More file actions
44 lines (39 loc) · 1.49 KB
/
Email Validator.py
File metadata and controls
44 lines (39 loc) · 1.49 KB
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
39
40
41
42
43
44
import tkinter as tk
from tkinter import messagebox
def show_popup():
# Creating the Main Window
root = tk.Tk()
root.withdraw() # hide the window
root.attributes("-topmost", True) # to set the main window on the top
messagebox.showinfo("Verified \u2611")
root.destroy() # Destroy the main window after the message box is closed
email = input("Enter your Email: ")
k,j,d = 0, 0, 0
# shortest email: g@g.in
if(len(email) >= 6): # Length Condition
if email[0].isalpha(): # First character = alphabet
if ('@' in email) and (email.count('@') == 1): # Condition for '@'
if (email[-4] == '.') ^ (email[-3] == '.') ^ (email[-3] == '.' and email[-6] == '.'): # Condition for '.'
for i in email:
if i.isspace(): # Condition for Space " "
k = 1
elif i.isalpha():
if i == i.upper(): # Uppercase Condition
j = 1
elif i.isdigit():
continue
elif i == "_" or i == "." or i == "@":
continue
else:
d = 1
if k == 1 or j == 1 or d == 1:
print("Wrong Email 5")
show_popup()
else:
print("Wrong Email 4")
else:
print("Wrong Email 3")
else:
print("Wrong Email 2")
else:
print("Wrong Email 1")