Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a new file called validate_email.py. In this file, you would need to implement the following function: def validate_email(email_address, email_suffix) This function takes in two

image text in transcribed

Create a new file called validate_email.py. In this file, you would need to implement the following function: def validate_email(email_address, email_suffix) This function takes in two strings email_address and email_suffix and returns True if the email address is valid and False otherwise. We define email_address as valid if the substring of what lies right of "@" exactly matches email_suffix. You should check the validity of the email address with the following rules: - email_address should contain exactly one "@". For example, for "gmail.com", email_address = "hello@worldegmail.com" is not valid, but email_address="helloworldegmail. com" is. - Other than leading and trailing spaces, email_address should not contain any space. For example, for email_suffix = "gmail.com", email_address = world@gmail.com " is not valid because of the spaces between "hello" and "world" but email_address =" helloworld@gmail.com " is valid. - The substring between "@" (not including "@") and the first trailing space (not including the space) or the end of the string if there is no trailing space should match the email_suffix. For example, for email_address = " helloworldegmail.com " , it is valid if email_suffix = "gmail.com", but not valid if email_suffix = "ucsd.edu" . - email_suffix can be any string, which means it may contains leading/trailing spaces itself. For example, email_address = " hello@ and email_suffix =" " should return False because of the leading space in the suffix

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 22nd International Conference Dexa 2011 Toulouse France August/September 2011 Proceedings Part 1 Lncs 6860

Authors: Abdelkader Hameurlain ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2011th Edition

3642230873, 978-3642230875

More Books

Students also viewed these Databases questions