Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 . 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. 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: eatwell Numeric telephone number is 328-9355 Enter a telephone 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 . 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. 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: eatwell Numeric telephone number is 328-9355 Enter a telephone number

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

Students also viewed these Databases questions

Question

4. Design a career management system.

Answered: 1 week ago