Question: Develop python program 1. Decoding Telephone Numbers (4 points) Some companies use letters to show their telephone numbers, in order to make the numbers easier
Develop python program
1. Decoding Telephone Numbers (4 points)
Some companies use letters to show their telephone numbers, in order to make the numbers easier to remember. For example, the telephone number GET-LOAN corresponds to 438-5626. Sometimes, companies might use more than 7 letters in order to make the translated number more meaningful (e.g., CALL-HOME for 225-5466, with the extra letters ignored).
Complete the phoneNumber() function, which takes a single string argument that consists of at least 7 capital letters. The function returns a new string containing just the digits of the corresponding telephone number. For simplicity, we will assume that the user input consists solely of capital letters, with no digits, symbols, lowercase letters, or spaces. Use the International Standard telephone keypad () to determine the letter-digit correspondences for your function.
Your function should only process the first 7 letters in a given encoded telephone number. For clarity, insert a single dash character ('-') after the third digit in the translated number. HINT: Start by defining a Python dictionary that maps letters to digits (use the link above to determine which letters map to which digits).
HINT: use the letters as your keys, and the digits as your dictionary values. Do not simply use a series of if statements in your program!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
