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 ____ tool allows a user to connect to the active registry database and make changes that are effective immediately. editreg.
kenny6666 [7]
Regedit is the Answer
3 0
3 years ago
Write a recursive function called digit_count() that takes a positive integer as a parameter and returns the number of digits in
Gelneren [198K]

Using the computational knowledge in python it is possible to write a code that Write a recursive function called digit_count()

<h3>What is a function in Python?</h3>

In Python, a function is a sequence of commands that performs some task and that has a name. Its main purpose is to help us organize programs into chunks that correspond to how we envision a solution to the problem.

<h3>Writting the code in python:</h3>

<em>def countDigits(n):</em>

<em>   if n< 10:</em>

<em>      return 1</em>

<em>   else:</em>

<em>       return 1 + countDigits(n / 10)</em>

See more about python at brainly.com/question/13437928

#SPJ1

8 0
2 years ago
PLS HELP ;CC
icang [17]

Answer:

a

early photographers who were first painters

Explanation:

The Rule of Thirds is a compositional technique which states that image painting, photograph, graphic design should be divided into nine equally proportioned boxes by creating a grid with two vertical and two horizontal lines. The rule of third helps in making the picture more attractive and balanced

The rule of thirds was first used in landscape paintings by painters as early as 1797.

5 0
3 years ago
I need answer poooo<br>​
Fiesta28 [93]

Answer:

what is this?Are yhere any options for this question ❓

7 0
2 years ago
When should the sponsor-monitor conduct the most detailed review of the study protocol with the site's study staff?
Likurg_2 [28]

Answer:

Site initiation visit is the correct answer.

Explanation:

Because the SIV is the sponsor-monitor which administers the detailed analysis of the site's study staff by the study protocol and it observes the process of the visite over a while that it take place after the visite of the site section. It also needed to set up the research site to administrates the analysis. So, that's why the following answer is true.

8 0
2 years ago
Other questions:
  • Which of the following is an occupation management group? Select the choice that best answers the question.
    15·1 answer
  • How to get 60 fps pubg​
    9·2 answers
  • If directory server a trusts directory server b, directory server b trusts directory server c, and directory server a trusts dir
    6·1 answer
  • Directions for starting the computer and opening a word processor document
    5·1 answer
  • You get a BRAINLIEST if you help me ASAP!
    11·2 answers
  • What are youth oraganizations?
    7·1 answer
  • Which network component blocks status?
    9·1 answer
  • 1.An algorithm used to find a value in an array is called a ______________.
    7·2 answers
  • A laptop computer manufacturer would consider the computer's processor chip to be a(n) ______ cost.
    14·1 answer
  • Define management styles
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!