Question: Write a Python application to verify correct phone number format, (703) 456-7890, by implementing the following: 1. Create an Exception class (PhoneNumberException) for detecting

Write a Python application to verify correct phone number format, (703) 456-7890, 

Write a Python application to verify correct phone number format, (703) 456-7890, by implementing the following: 1. Create an Exception class (PhoneNumberException) for detecting an invalid phone number format. The class must provide a default error message, "Error: Invalid Phone Number Format." 2. Create a Python application that reads a phone number. 3. Use the try and except blocks to detect and handle incorrect format. For example: Enter Phone Number (xxxxx) xxx-xxxx: 7034567890 Error: Invalid Phone Number Format. Enter Phone Number (xxx) xxx-xxxx: 703-456-7890 Error: Invalid Phone Number Format. Enter Phone Number (xxx) xxx-xxxx: (703)456-7890 Error: Invalid Phone Number Format. 4. If there is no error, the application displays that the phone number entered is valid. Enter Phone Number (xxx) xxx-xxxx: (703) 456-7890 (703) 456-7890 is valid

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!