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
Where is the start frame delimiter found in the Ethernet frame
Ksju [112]
Answer: The SFD is the eight-bit (one-byte) value that marks the end of the preamble, which is the first field of an Ethernet packet, and indicates the beginning of the Ethernet frame.
8 0
3 years ago
I have a question about this programming assignment. The outcome when the user puts in Taylor for guest one and Fernando for gue
ivolga24 [154]
Yes u need more brackets
4 0
3 years ago
Read 2 more answers
On the Next Generation firewall, what type of security profile detects infected files being transferred with the application?
laiz [17]

Answer:

Anti-Virus.

Explanation:

Anti-virus is the type of security profile detecting infected files transmitted with the software.

It is a kind of program that designed and developed to guard computers against threats such as malware, program viruses, trojan, botnets, keylogging software, malicious software etc. The following apps work for scanning, detecting and removing threats out of your system.

6 0
3 years ago
You are the network administrator for a growing business. when you were initially hired, the organization was small and only a s
k0ka [10]
Usually, network devices can be set up to send their syslog messages to a syslog server, so you'd just need a *nix computer with syslog setup to receive messages via the network, and you can read stuff there. You also get the advantage of having reglar expressions so that "noise" (messages you don't care about) isn't displayed.

Network devices can also be set up to use SNMP (Simple Network Management Protocol).

6 0
3 years ago
Assume that a variable hoursWorked has been initialized. Write a statement that assigns the value True to the variable workedOve
mariarad [96]

Answer:

Following are the statement which is given below:

workedOvertime= hoursWorked > 40 //assigns the value to workedOvertime

Explanation:

In this above statement, there is hoursWorked variable which is already initialized There is also another variable "workedOvertime" which assigns the value of the TRUE if the "hoursWorked" is greater then the 40 otherwise it initializes the value FALSE in the "workedOvertime" variable.

The > operator is used for checking the condition that variable "hoursWorked" is greater than 40 or not.

5 0
4 years ago
Other questions:
  • Can somebody help me?
    11·1 answer
  • When might be the best time to start saving for retirement?
    11·2 answers
  • For connection to place on any network you must have a set of standards?<br> O True<br> O False
    8·1 answer
  • Photography is harder with digital cameras than with film cameras.<br>true<br>false
    6·2 answers
  • Which of the following situations would not require knowledge of networking?
    11·2 answers
  • What best determines whether a borrower's interest rate on an adjustable rato loan goes up or down?
    13·2 answers
  • If there are over 1,000 websites about a certain topic, the information is reliable. A. True B. False
    12·1 answer
  • What is the internet​
    14·2 answers
  • The _____ layer addresses how the software will execute on specific computers and networks.
    14·2 answers
  • a functional policy declares an organization's management direction for security in such specific functional areas as email, rem
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!