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
The underground storage of a gas station has leaked gasoline into the ground. Among the constituents of gasoline are benzene, wi
vovangra [49]

Answer:

a) benzene = 910 days

b) toluene = 1612.67 days

Explanation:

Given:

Kd = 1.8 L/kg (benzene)

Kd = 3.3 L/kg (toluene)

psolid = solids density = 2.6 kg/L

K = 2.9x10⁻⁵m/s

pores = n = 0.37

water table = 0.4 m

ground water = 15 m

u = K/n = (2.9x10⁻⁵ * (0.4/15)) / 0.37 = 2.09x10⁻⁶m/s

a) For benzene:

R=1+\frac{\rho * K_{d}  }{n}, \rho = 2.6\\ R=1+\frac{2.6*1.8}{0.37} =13.65

The time will take will be:

t=\frac{xR}{a} , x=12,a=0.18\\t=\frac{12*13.65}{0.18} =910days

b) For toluene:

R=1+\frac{2.6*3.3  }{0.37} = 24.19

t=\frac{12*24.19}{0.18} =1612.67days

6 0
3 years ago
Read 2 more answers
An engine needs to be moved. Technician A says
DiKsa [7]

Answer:

I think technician B is right because when two people slide the engine out of the way, it could get damaged in any part. That's why an engine crane is preferable

5 0
3 years ago
A hollow aluminum sphere, with an electrical heater in the center, is used in tests to determine the thermal conductivity of ins
serg [7]

Answer:

Explanation:

This is a questions that can be answered using electrical resistance analogy. The expression for the

8 0
3 years ago
Read 2 more answers
g Consider the following observations on shear strength (MPa) of a joint bonded in a particular manner. 22.6 40.4 16.4 72.4 36.6
Blababa [14]
Wow same question!!! Nice
4 0
3 years ago
A game rolls a die 10 times and counts how many times the number 5 or 6 shows up.
madam [21]

Answer:

Explanation:

Let's do this in python. We can start by filtering the result by 5 and 6. Then we will count the number of items in the filtered array. Finally, a conditional statement to output the result.

def payOut(ten_rolls):

    five_or_six = [roll for roll in ten_rolls if roll in [5,6]]

    count_5_or_6 = len(five_of_six)

    if count_5_or_6  >= 7:

         return 2

    elif count_5_or_6 >=4:

         return 1

    else return 0

8 0
4 years ago
Other questions:
  • Two kg of N2 at 450 K, 7 bar is contained in a rigid tank connected by a valve to another rigid tank holding 1 kg of O2 at 300 K
    13·1 answer
  • How 2 mak robut??...
    6·2 answers
  • If you detect that something’s wrong while lowering a lift, you should try to get the vehicle down as fast as possible
    15·1 answer
  • 1. How many pieces of 12-1/2" long wood can be cut from a piece of
    14·1 answer
  • How do people eat with there noses shut
    12·2 answers
  • Tell me a riddle and whoevers i like best gets brainliest
    6·1 answer
  • (a) Show how two 2-to-1 multiplexers (with no added gates) could be connected to form a 3-to-1 MUX. Input selection should be as
    5·1 answer
  • Where has the process of nuclear fusion been occurring for over four billion years
    6·1 answer
  • Pie charts should have no more than eight segments. True or False?
    12·2 answers
  • scrapers are used to haul dirt from a borrow pit to the cap of a landfill. the estimated cycle time for the scrapers is 9.5 minu
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!