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
7.3 Code Practice edhesive
sladkih [1.3K]

Answer:

def print_sum(a,b,c):

 print(a+b+c)

one = int(input("Enter the 1st number: "))

two = int(input("Enter the 2nd number: "))

three = int(input("Enter the 3rd number: "))

print_sum(one,two,three)

Explanation:

hope this helped :)

5 0
2 years ago
Read 2 more answers
Q1: what is significant about the contents of the destination address field?
Stells [14]
<span>The destination address field must contain the MAC address.
The MAC address is needed to help find a device for an ARP request.</span>
All hosts on the LAN will receive this broadcast frame. The host with the IP address of 192.168.1.1 (default gateway) will send a unicast reply to the source (PC host). This reply contains the MAC address of the NIC of the Default Gateway.
5 0
3 years ago
Read 2 more answers
Why is it difficult to enforce laws against intellectual theft?
LiRa [457]

Answer:

A-because most of the victims of intellectual theft are individuals  

Explanation:

Its definitely the first, and not B., C, or D,

Countries are no barrier in catching the theft, as almost all the countries now have issued the online identification number of each of their citizens. However, some of them are in the process. Hence, for next one - two years we can add add the B as well:

B-because much intellectual theft is committed in other countries

However, as this work is complete, the B option will not be an issue related to intellectual theft analysis and control.

And  C and D are definitely not the part of the answer, as associations like FCC USA, Internet association etc  are technically sound enough, and quite good to fight a case under any law as well.

7 0
3 years ago
Which type of mountain is formed due to the collision of two different kinds of plates?
Lyrx [107]
D) Andean mountains are formed due to the collision of two different kinds of plates.
6 0
3 years ago
Read 2 more answers
What is the difference between Notepad and WordPad?is one more adavnced?if so which one or Notepad is the Mac equivalent of Word
Kitty [74]
WordPad is defenitely more advanced.
There is no Mac equivalent.
4 0
3 years ago
Other questions:
  • The ____ contains the computer's "brain," the central processing unit (CPU).
    5·2 answers
  • Which of the following is NOT necessary for organizing data to make it easier to sort?
    6·1 answer
  • IN C++ PLEASE!!!! Define a function FilterStr() that takes a string parameter and returns "Good" if the character at index 4 in
    7·1 answer
  • What can the tab key do
    10·1 answer
  • Write a method for the Invitation class that accepts a parameter and uses it to update the address for the event.
    9·1 answer
  • Which statements accurately describe the Outlook interface? Check all that apply.
    7·1 answer
  • The Table Design and Layout tabs are available under the
    13·2 answers
  • Compare mini and mainframe computer in terms of speed,memory and storage​
    15·1 answer
  • The bullet points above describe _____.
    7·1 answer
  • How ict tools changed the way we live explain it​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!