Question: The program will take an email address from user and check if it contains the following: a. Address must contain at least an @ symbol

The program will take an email address from user and check if it contains the following:

a. Address must contain at least an ‘@’ symbol

b. Address must contain at least a ‘.edu’ suffix

c. Length must contain at least 12 characters.

d. Address must contain at least one digit

2. Helper functions to check if an address has at least one digit is provided. Docstring are also given in the template file. This function returns True if condition satisfies otherwise returns False.

3. Your task: Design a base class (Invalid Address) and child exception classes (InsufficientLength, NoDigit, NoEdu, NoAtSymbol ) to raise the exception when the conditions are not met.

4. Design a simple user menu to ask for the address as long as the user does not enter a valid address.

5. The menu should also make a try-except block to call for appropriate Exception class as needed. If none of the exception occurs the program will print a message as shown in sample I/O.

6. Hint: A sample problem structure can be found in Exceptionslecture: designing a number guessing game.

 

Sample I/O:

Enter your email address: ih@gmu.edu

Address must have at least 12 characters

Enter your email address: janedough@gmu.edu

Address must contain at least one digits (0-9)

Enter your email address: janedough22gmu.edu

Address must contain one @

Enter your email address: janedough22@gmu.com

Address must contain .edu suffix

Enter your email address: janedough22@gmu.edu

Valid address: janedough22@gmu.edu

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

class InvalidAddressException pass class InsufficientLengthInvalidAddress pass class NoDigitInvalidA... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!