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
The points a b c and d lie on a straight line ab:bd = 1:4
pochemuha

The points a b c and d lie on a straight line ab:bd = 1:4 are A line that extends to infinity on both sides and has no curves is called a straight line.AB:BC=3:4.

<h3>What do you call a straight line?  </h3>

A line is simply an object in geometry denoted as an object with no width that extends on both sides. A straight line is just a line with no curves.

  • AC=AB+BC=3+4=7;  AC:CD=2:1, i.e. AC=2;   because we get 2 different lengths for AC, we change the given ratio AC:CD to an equivalent one with AC=7 .
  • As follows: AC:CD = 2 : 1 = 7 : 3.5 (multiply both sides by 3.5 )   Now we have AC:CD = 7 : 3.5 and AD = AC+CD= 7+3.5 = 10.5,, and the answer is: the ratio  BC:AD = 4:10.5.

Read more about the straight line:

brainly.com/question/3493733

#SPJ1

3 0
2 years ago
The marvelous attribute about the gaming industry is that you can create a game in several different programming languages to ma
LenaWriter [7]

Answer:

D syntax

Explanation:

The marvelous attribute about the gaming industry is that you can create a game in several different programming languages to make it more appealing to novice and advanced-level coders. Yet, the unique distinction is that every single programming language has its own syntax.

7 0
2 years ago
Ravi is writing an essay on the impact of the internet on business. Help him classify the scenarios he sees around him as positi
Radda [10]

Answer: See explanation

Explanation:

Based on the options given, the positive effects of the internet on business will be:

• He recently bought a second-hand camera online, which he hadn't been able to find in any store.

• His friend sell printed T-shirts online, storing them in his basement and promoting them on social media.

The negative effects of the internet on business will be:

• A bookstore down the road shut down because people preferred the cheaper online bookstores.

• Ravi's sister complains that her boss always knows when she is late, but rarely greets her if their paths cross in office.

• One of his friend's printed T-shirts got wet and stained in the delivery truck and the buyer wrote a nasty review.

6 0
2 years ago
What is self management.​
OLEGan [10]

Answer:

Self management is being able to control your emotion & behavior. This is a very important life skill

Explanation:

8 0
2 years ago
Read 2 more answers
Do warnings ever expire?
DIA [1.3K]
What’s a warning? how do i get one haha
7 0
3 years ago
Read 2 more answers
Other questions:
  • Which OS function does a CLI fulfill? A User interface B Running applications C Hardware interface D Booting
    8·1 answer
  • The function below takes a single parameters: a list of numbers called num_list. Return a new list containing just the three lar
    5·1 answer
  • Which term refers to a type of an attack in which an attacker makes his data look like it is coming from a different source addr
    10·1 answer
  • If an engine has four cylinders and a total of 16 valves, how many valves would each cylinder have? A. Two B. One C. Four D. Thr
    12·1 answer
  • Ashley Baker has been the webmaster for Berryhill Finance only ten days when she received an e-mail that threatened to shut down
    13·1 answer
  • What is the critical path?
    15·1 answer
  • Your computer system is a participant in an asymmetric cryptography system. You've crafted a message to be sent to another user.
    13·1 answer
  • Help plz
    10·1 answer
  • Derek has to create a technical design of a complex floor plan using CAD. What will be most helpful for Derek to use to create t
    8·1 answer
  • How do I write a good personal narrative pls help im struggling very hard rn.​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!