1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
IrinaVladis [17]
3 years ago
6

The international standard letter/number mapping for telephones is: Write a function that returns a number, given an uppercase l

etter, as follows: def getNumber(uppercaseLetter): Write a test program that prompts the user to enter a phone number as a string. The input number may contain letters. The program translates a letter (uppercase or lowercase) to a digit and leaves all other characters intact. Here is a sample run of the program

Engineering
1 answer:
wolverine [178]3 years ago
5 0

Answer:

Complete Python code along with step by step explanation and output results is provided below.

Python Code with Explanation:

# create a function named getNumber(c)

# Using if elif conditions implement the phonetic character to number conversion for both lower case and upper case letters.

def getNumber(c):

   if(c=='a' or c== 'b' or c=='c' or c=='A' or c == 'B' or c == 'C'):

       return (2)

   elif(c=='d' or c== 'e' or c=='f' or c=='D' or c == 'E' or c == 'F'):

       return (3)

   elif(c=='g' or c== 'h' or c=='i' or c=='G' or c == 'H' or c == 'I'):

       return (4)

   elif(c=='j' or c== 'k' or c=='l' or c=='J' or c == 'K' or c == 'L'):

       return (5)

   elif(c=='m' or c== 'n' or c=='o' or c=='M' or c == 'N' or c == 'O'):

       return (6)

   elif(c=='p' or c== 'q' or c=='r' or c=='s' or c=='P' or c == 'Q' or c == 'R' or c == 'S'):

       return (7)

   elif(c=='t' or c== 'u' or c=='v' or c=='T' or c == 'U' or c == 'V'):

       return (8)

   elif(c=='w' or c== 'x' or c=='y' or c=='z' or c=='W' or c == 'X' or c == 'Y' or c == 'Z'):

       return (9)

   else:

       return (0)

# Get input string from the user

string = input("Please enter any string to convert! ")

# find the length of the input string for the for loop

length = len(string)

# Run a for loop length number of times to call the function getNumber(c) and convert the characters into numbers

for i in range(length):

   c = string[i]

   k = getNumber(c)

   if(k==0):

       print (c,end="")

   else:

       print (k,end="")

# end="" is used so that all numbers displayed in one line

Output:

Please enter any string to convert! Hello WORLD

43556 96753

Please enter any string to convert! Brainly

2724659

You might be interested in
Barries of effective <br> communication?
GarryVolchara [31]

Answer: barries

Explanation:

4 0
3 years ago
11) 6x^2-49x - 45<br> What is the factored answer to this trinomial
Lady bird [3.3K]
Factores is (6x+5)(x-9)
3 0
3 years ago
Which items are NOT found on a
Alja [10]

Answer:

None of the above cause thats what i put

3 0
3 years ago
LINKS GET BODIED ON SITE! RAWR
bulgar [2K]

Answer:

False

Explanation:

MRK ME BRAINLIEST PLZZZZZZZZZZZZZZZZZZ

7 0
4 years ago
What is an ip<br> Number
gladu [14]

Answer:

im not sure but kermeen looks like he has a good answer u can give him brainilest

Explanation:

8 0
3 years ago
Other questions:
  • In case the Rectilinear distance is considered, find the optimal coordinates (X,Y) of new facility. Q2) Show and label the exist
    7·1 answer
  • An 800-kg drag racer accelerates from rest to 390 km/hr in 5.8 s. What is the net impulse applied to the racer in the first 5.8
    10·1 answer
  • A 10-V battery supplies a constant current of 0.5 amp to a resistance for 30 min.
    5·1 answer
  • A 75 mm diameter, 15 mm wide A80-M12V grinding wheel is used for traverse surface grinding of a 75 mm by 75 mm 1040 steel workpi
    12·1 answer
  • An average person produce 0.25 kg of moisture while taking a shower and 0.05 kg while bathing in a tub. Consider a family of fou
    7·1 answer
  • As the impurity concentration in solid solution of a metal is increased, the tensile strength:________.a) decreasesb) increasesc
    9·1 answer
  • Catch of the day:
    9·2 answers
  • dentify a semiconducting material and provide the value of its band gap) that could be used in: (a) (1 point) red LED (b) (1 poi
    10·1 answer
  • How is everybody day going i`m 6 months pregnant
    6·1 answer
  • Sketch the asymptotes of the Bode plot magnitude and phase for the open-loop transfer ()=100(S+1)/((S+10)(S+100)) Use MATLAB to
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!