Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Develop and test a Python program that will prompt a user to enter telephone numbers containing letters and then output the corresponding numeric phone number
Develop and test a Python program that will prompt a user to enter telephone numbers containing letters and then output the corresponding numeric phone number using the International Standard for Phone Key Pads (see pad html for the standard for newer phones). For example, the phone number 407-GIFT is equivalent to 407-4438 Requirements/Constraints: Your program must do the following Use a Python dictionary to perform the letter-to-number conversion. Ensure that pPhone numbers can be input in upper or lower case using any or no punctuation. For example, '651.EAT.WELL' (651) EAT WELL 651eatWell' and '651 EAT#WELL' are all valid inputs. Validate the input to ensure it contains either 7 or 10 "digits" (not including punctuation) Output the converted phone number using hyphen characters in one of the following forms as appropriate for the number of digits: . . nnn-nnnrn Continue converting telephone numbers until the user enters a null string, at which point your program should terminate Your program should implement and use a non-pure function to get and validate the phone number entered by the user Your program should implement and use a pure function that accepts a valid phone number string as a parameter and returns the correct numeric phone number . . Additional Constraints: Do not import/use any library modules e An example run of your program might look as follows Enter a telephone number 651.eat.well Numeric telephone number is 651-328-9355 Enter a telephone number 612.eat.beets Error: Invalid number! Enter a telephone number: Eat the Food Numeric telephone number is: 328-843-3663 Enter a telephone number eatiwell Numeric telephone number is 328-9355 Enter a telephone number
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