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
Bond [772]
3 years ago
11

Write a function that takes a string like 'one five two' and returns the corresponding integer (in this case, 152). A function j

ust like this would be used in a speech recognition system (e.g. automated phone taxi bookings) to convert a spoken number into an integer value. Here is an attempt that won't work. Your task is to replace the function body with something that works:

Computers and Technology
2 answers:
Lelu [443]3 years ago
4 0

Answer:

see explaination

Explanation:

def words2number(s):

words = s.split()

numbers = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']

result = ""

for word in words:

if word in numbers:

result += str(numbers.index(word))

return result

nikitadnepr [17]3 years ago
4 0

Answer:

Check the explanation

Explanation:

def words2number(s):

   words = s.split()

   numbers = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']

   result = ""

   for word in words:

       if word in numbers:

           result += str(numbers.index(word))

   return result

# remove below test line before submitting this code.

print(words2number('one five two'))

Kindly check the attached image below for the code output.

You might be interested in
Why is the engineering design process important to the customer?
Ket [755]

The engineering design process important to the customer layout system permits things: A shared technique on a way to discover and remedy problems. A framework to assess ideas, tell priorities and save you myopic paintings.

<h3>What is the maximum vital step withinside the engineering layout system?</h3>

The first step withinside the engineering layout system is to outline the trouble that you are solving. This step is the maximum vital, as a defective know-how of the trouble handy ends in layout failures. Engineers paintings to discover the foundation trouble via way of means of opposite engineering the signs and symptoms they perceive.

The engineering layout system, via way of means of definition, is a sequence of steps that engineers use to discover an option to a trouble. These steps include: defining the trouble, brainstorming solutions, designing and constructing a prototype of the solution, trying out the solution, and enhancing it.

Read more bout the engineering :

brainly.com/question/17169621

#SPJ1

8 0
2 years ago
What tab do you still like to preview for your presentation?
Vilka [71]
You click on slideshow,
Then click on present
7 0
4 years ago
Read 2 more answers
Which was the first computer brought in nepal?<br>​
Natasha_Volkova [10]

Answer:

the first conputer brought in nepal was IBM 1401

3 0
3 years ago
Read 2 more answers
Pasar el número 12875 del sistema decimal al sistema octal.
PolarNik [594]

Answer:

Va Bene

Explanation:

Insiama ma parla da auditore

4 0
3 years ago
Ballet was originally created for the wedding celebration of Louis XVI and Marie Antoinette. (True or False)
erastova [34]

Answer:

true

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • Sam wanted to open a file that he saved yesterday. Which component inside the computer stores this file? the hard drive the fax
    13·2 answers
  • Why can't cruise control work under 25 mph?
    9·1 answer
  • Which protocol below is used to email clients to send email
    6·1 answer
  • 12. When trying to identify the sorted column in a table, you would look for the column where A. an arrow is displayed in the fi
    10·2 answers
  • (BRAINLIEST FOR FIRST CORRECT ANSWER) Mark (all) the statements that best describe the use of spreadsheets and tables in present
    15·1 answer
  • The scene of a human sitting at a computer terminal, responding to stimuli flashed on the computer screen, would most likely be
    7·1 answer
  • How does an operating system manage peripheral devices?
    6·1 answer
  • Write a 3-4 page paper (500-800 words) about your project that explains your project, the type of conditioning you used, and the
    10·1 answer
  • What were the social, political, cultural, or economic context in which the was invention made?
    14·1 answer
  • can you guys plz answeer this i need help rrly bad and plz no viruses or links or answers that have nun to do with this
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!