Problem Statement: The purpose of this lab assignment is to gain experience in python’s Exception handling. In this assignment, you will write a program for .edu email address validation system. Problem Design: 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
Problem Statement:
The purpose of this lab assignment is to gain experience in python’s Exception handling. In this
assignment, you will write a program for .edu email address validation system.
Problem Design: 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
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images