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]
4 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]4 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]4 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
SOMEBODY HELP ME ASAP PLEASE AND THANK YOU
Paha777 [63]

Answer:

Isnt there another thing that is supposed to be there like some website

Explanation:

7 0
3 years ago
Read 2 more answers
U GET BRAINLIEST HELP PLZ
Art [367]
BOTH OF THEM ARE C : )
3 0
3 years ago
The preferred means of creating multithreaded Java applications is by implementing the ________ interface. An object of a class
Kaylis [27]

Answer:

Runnable.

Explanation:

Java is an all round programming language which is typically object-oriented and class-based. It was designed by James Gosling, developed by Sun microsystems and released officially on the 23rd of May, 1995. Java programming language is designed to have only a few implementation dependencies as possible because it was intended to be written once, and run on any platform.

Java makes concurrency to be available to software developers through the application programming interface (API) and the language. Also, it supports multiple threads of execution, by making each thread have its respective program counter and method-call stack, which then allow concurrent executions with other threads.

The preferred means of creating multithreaded Java applications is by implementing the runnable interface. An object of a class that implements this interface represents a task to perform. The code is public void run ().

8 0
3 years ago
an images scanned from a CD cover does not have to be cited because you didn't find the image on the internet True or false
ruslelena [56]

Answer:

False

Explanation:

When searching on the internet, I found flashcards containing this information.

6 0
3 years ago
Type the correct answer in the box. Spell all words correctly.
puteri [66]

Explanation:

Type the correct answer in the box. Spell all words correctly.

Ben has to type a long letter to his friend. What is the correct keying technique that Ben should use?

To prevent strain and key correctly, Ben should use his fingers gently over the keys with his wrist in a flat position.

7 0
3 years ago
Other questions:
  • What is the different between a computer and a phone?​
    15·1 answer
  • Which quality is likely to ensure consistent career growth in the computer field?
    9·2 answers
  • For a Windows laptop, what is the best way to save power when the computer will not be used for an extended period?
    14·2 answers
  • Show the output waveform of an AND gate with the inputs A, B,
    5·1 answer
  • A _____ is an example of a systems program. A. command interpreter B. web browser C. text formatter D. database system
    10·1 answer
  • Hard and soft skills can both be transferable skills. *<br><br> True<br><br> False
    5·2 answers
  • What are the advantages of using ICT jn our society?​
    8·2 answers
  • According to institutional anomie theory, why is there a need to maintain cooperation between economic and non-economic institut
    9·1 answer
  • Which of the following will Excel recognize as a date?
    12·1 answer
  • Write a recursive decent algorithm for a java while statement, a Javas if statement , an logical/mathematical expression based o
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!