Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This should be done in python Use the Design Recipe to write a function called i

ID: 3715671 • Letter: T

Question

This should be done in python

Use the Design Recipe to write a function called is_valid_registration() whichconsumes 3 strings: an email, a password, and a confirmation of the password.

Thisfunction will serve as a component for our ice cream company’s registration systemand will determine whether ALL three registration details are valid.

In order for theemail to be a valid email address, the email must be in the following format:<username>@<domainname>.<TLD>.

(Note: TLD is top level domain name e.g. com, gov, net , and org)

The length of their username and domain name must be greater than 1 character.The length of the TLD must either be 2 or 3 characters.

In order for the password to be valid, a password must:

(1) be from 8 to 15 characters long

(2) contain one uppercase letter

(3) contain at least one lowercase letter

(4) contain at least one numeric digit (0-9)

(5) contain at least one special character in the set {#,$,%,^, &, *, +, =}.

A valid password must not contain any characters other than letters, digits, and theset of special characters listed previously.

In addition to the password being valid, the confirmation password must be thesame as the password. Your function should returnTrue

if the email, password, andconfirmation password is valid. If the email or password is invalid, your functionshould return False

.

Explanation / Answer

ScreenShot

Program

#import regular expression package
import re
#Validating function
def is_valid_registration(email,pswd,cpswd):
    #email matching regular expression
    email_pattern = '^(w+)(@w+)(.w{2,3})$'
    #pswd matching regular expression
    pswd_pattern='[A-Z&a-z&0-9+&#|$|%|^|&|+|=]{8,15}'
    #condition to check all matches and print result
    if re.match(email_pattern,email) and re.match(pswd_pattern,pswd) and pswd==cpswd :
        print('Login successfully')
    else:
        print('Failed')
#Main method definiton      
def main():
    #Initialize values for check
    email='hari@mail.com'
    pswd='123Atsl&'
    cpswd='123Atsl&'
    #Call check function
    is_valid_registration(email,pswd,cpswd)
      
#main method
if __name__==main:
    main()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote