Problem Statement: The purpose of this lab assignment is to gain experience in python's Exception handling. In this assi
Posted: Tue Jul 05, 2022 10:25 am
provide screenshots of code please
and ability to copy and paste
simple python code
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 Exceptions lecture: designing a number guessing game. Sample I/O: Enter your email address: [email protected] Address must have at least 12 characters Enter your email address: [email protected] Address must contain at least one digits (0-9) Enter your email address: janedough22gmu.edu Address must contain one @ Enter your email address: [email protected] Address must contain .edu suffix Enter your email address: [email protected] Valid address: [email protected]
# Code: Code starts here #define exceptions classes InsufficientLength, NoDigit, NoEdu and NoAtSymbol # sample code can be Number Guessing Game #helper functions def has_digit(address): Checks if an address string has at least one digit.| Returns True if at least one digit is present, False otherwise return any([char.isdigit() for char in password]) # a simple user menu using while loop #keep asking for the correct address. #as long as the address does not meet all the #validity criteria