From 9130c73fca91fe88f3dc6d1054ade4b667c793bc Mon Sep 17 00:00:00 2001 From: Nikhil Date: Mon, 4 Oct 2021 20:57:01 +0530 Subject: [PATCH 1/3] [ADD] Email Validation --- Email Slicer/EmailSlicer.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Email Slicer/EmailSlicer.py b/Email Slicer/EmailSlicer.py index e6506ad5..54171bcf 100644 --- a/Email Slicer/EmailSlicer.py +++ b/Email Slicer/EmailSlicer.py @@ -1,5 +1,21 @@ +import re + +def isValidEmail(email): + + # Regular expression for validating an Email + regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b' + + if(re.fullmatch(regex, email)): + return True + else: + return False + email = input("Enter your email id - ") -username = email[0:email.index('@')] -domain = email[email.index('@')+1: ] -print("Username - ", username) -print("Domain - ", domain) + +if isValidEmail(email): + username = email[0:email.index('@')] + domain = email[email.index('@')+1: ] + print("Username - ", username) + print("Domain - ", domain) +else: + print("Invalid Email!") \ No newline at end of file From 4e060995b38d51213fcd0a8df1cd2b7f8c4fdd75 Mon Sep 17 00:00:00 2001 From: Nikhil Date: Mon, 4 Oct 2021 21:46:40 +0530 Subject: [PATCH 2/3] [FIX] UI Corrected --- Smart_Calculator/calculator.py | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/Smart_Calculator/calculator.py b/Smart_Calculator/calculator.py index e0a23ee2..7e3aa294 100644 --- a/Smart_Calculator/calculator.py +++ b/Smart_Calculator/calculator.py @@ -68,21 +68,28 @@ def calculate(): win.geometry('500x300') win.configure(bg='lightskyblue') -l1 = Label(win, text='I am a smart calculator', width=20, padx=3) -l1.place(x=150,y=10) -l2 = Label(win, text='My name is Leah', padx=3) -l2.place(x=180,y=40) -l3 = Label(win, text='What can I help you?', padx=3) -l3.place(x=176,y=130) +win.resizable(0, 0) +win.columnconfigure(0, weight=1) +win.columnconfigure(1, weight=2) +win.columnconfigure(2, weight=1) + +l1 = Label(win, text='I am a smart calculator', width=20) +l1.grid(column=1, row=1, padx=5, pady=10) + +l2 = Label(win, text='My name is Leah', width=20) +l2.grid(column=1, row=2, padx=5, pady=10) + +l3 = Label(win, text='What can I help you?', width=20) +l3.grid(column=1, row=3, padx=5, pady=10) textin = StringVar() -e1 = Entry(win, width=30,textvariable=textin) -e1.place(x=100,y=160) +e1 = Entry(win, width=30, textvariable=textin) +e1.grid(column=1, row=4, padx=5, pady=10) -b1 = Button(win, text='Just this',command=calculate) -b1.place(x=210,y=200) +b1 = Button(win, text='Just this', command=calculate) +b1.grid(column=1, row=5, padx=5, pady=10) -list = Listbox(win,width=20,height=3) -list.place(x=150,y=230) +list = Listbox(win, width=40, height=3) +list.grid(column=1, row=6, padx=5, pady=10) win.mainloop() From cd70a6a43408ce74cff501ce4d4658ab82260c2d Mon Sep 17 00:00:00 2001 From: Nikhil Date: Mon, 4 Oct 2021 21:47:31 +0530 Subject: [PATCH 3/3] [FIX] Input data Typo corrected --- Smart_Calculator/calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Smart_Calculator/calculator.py b/Smart_Calculator/calculator.py index 7e3aa294..7a99bc44 100644 --- a/Smart_Calculator/calculator.py +++ b/Smart_Calculator/calculator.py @@ -60,7 +60,7 @@ def calculate(): 'SUB':sub, 'DIFFERENCE':sub, 'MINUS': sub, 'SUBTRACT':sub, 'LCM':lcm, 'HCF':hcf, 'PRODUCT':mul, 'MULTIPLICATION':mul, 'MULTIPLY':mul, 'DIVISION':div, 'DIV':div, 'DIVIDE':div, - 'MOD':mod,'REMANDER':mod, 'MODULUS':mod} + 'MOD':mod,'REMAINDER':mod, 'MODULUS':mod} win = Tk()