Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started