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 field of ____ is concerned with the technical issues involved in information display. computer science
Nataliya [291]

The field of <u>Computer graphics</u> is concerned with the technical issues involved in the information display. The correct option is A.

<h3>What is computer graphics?</h3>

Computer graphics is a branch of computer science called computer graphics research techniques for digitally synthesizing and modifying visual content.

Even while the phrase is frequently used to describe the study of three-dimensional computer graphics, it also includes image processing and two-dimensional graphics. This section works for information display.

Thus, the correct option is A. Computer graphics.

To learn more about computer graphics, refer to the link:

brainly.com/question/1169945

#SPJ4

The question is incomplete. Your most probably complete question is given below:

Computer graphics

computer-aided visualization

computer visualization

engineering graphics

7 0
1 year ago
Lab Goal : This lab was designed to demonstrate the similarities and differences in a for loop and a while loop.Lab Description
Mandarinka [93]

Answer:

See Explanation

Explanation:

Required:

Use for and while loop for the same program

<u>(1) String Cleaner</u>

#For Loop

name = "I am Sam"

result = ""  

<em>for i in range(0, len(name)):  </em>

<em>    if name[i]!= 'a':  </em>

<em>        result = result + name[i] </em>

print(result)

#While Loop

name = "I am Sam"

result = ""  

<em>i = 0 </em>

<em>while i < len(name): </em>

<em>    if name[i]!= 'a':  </em>

<em>        result = result + name[i] </em>

<em>    i+=1 </em>

print(result)

<u>(2): Common Divisor</u>

#For Loop

num1 = 528

num2 = 60

div = num2

if num1 > num2:

   div = num1

<em>for i in range(2,div):</em>

<em>    if num1%i == 0 and num2%i==0:</em>

<em>        print(i,end = " ")</em>

print()

#While Loop

num1 = 528

num2 = 60

div = num2

if num1 > num2:

   div = num1

i = 2

<em>while i <div:</em>

<em>    if num1%i == 0 and num2%i==0:</em>

<em>        print(i,end = " ")</em>

   i+=1

The iterates statements show the difference in the usage of both loops.

For the for loop, the syntax is:

<em>for [iterating-variable] in range(begin,end-1)</em>

<em>-------</em>

<em>---</em>

<em>--</em>

<em />

For the while loop, the syntax is:

<em>while(condition)</em>

<em>-------</em>

<em>---</em>

<em>--</em>

8 0
2 years ago
Identify a true statement about heuristics: a. They are more complicated than algorithms. b. Unlike algorithms, they do not perm
STatiana [176]

Answer:

The appropriate alternative is Option d.

Explanation:

  • Heuristic also seems to be essentially a methodology that solves numerous major issues in an even cheaper manner. It requires less effort than those of the traditional techniques. It's providing accurate solutions. It has a broader potential in the treatment of computer engineering. It is already being shown in quantum computing.
  • Mathematical implementations also contribute significantly to heuristics. This could make concessions on the component of optimal performance. It can also make concessions on the degree of consistency. It helps to achieve international headquarters at quite a quicker speed.

The latter decisions made are not connected to the conditions. So the above comment is correct.

4 0
3 years ago
How does toothbrushes affect the world of technology?
Yuri [45]

Answer:

The invention of the toothbrush made a huge impact of society and people for many reasons. You should always brush your teeth and keep your mouth clean so you will have nice, white teeth, healthy gums, good breath, and just a clean mouth! Without the toothbrush, your mouth would be smelly, gross, and full of bacteria.Some of the different impact categories included acidification, climate change, eutrophication, human health, land use, resource use and water scarcity. The results concluded that the electric toothbrush had the greatest environmental impact in 15 out of the 16 categories with water scarcity being the exception.Using the electric toothbrush as an example, this article examines the growing acceptability of domestic health technologies that blur the traditional boundaries between health, aesthetics and consumption. By using empirical material from individual and household interviews about people's oral health practices, this research explores the relationships between an everyday artefact, its users and their environments. It investigates the ways in which oral health technologies do, or do not, become domesticated in the home environment. We conclude that the domestication of oral health technologies is not inevitable, with the electric toothbrush often becoming an ‘unstable object' in the domestic setting.

Explanation:

3 0
2 years ago
Read 2 more answers
Create an array of 10 fortune cookie sayings that will be randomly displayed each time the user reloads the page. The fortune wi
vfiekz [6]

Answer:

let cookieNumber = Math.floor(Math.random() * 10)

switch (cookieNumber) {

  case 1:

   document.write('Fortune 1')

   break;

  case 2:

   document.write('Fortune 2')

   break;

   case 3:

   document.write('Fortune 3')

   break;

  case 4:

   document.write('Fortune 4')

   break;

  case 5:

   document.write('Fortune 5')

   break;

  case 6:

   document.write('Fortune 6')

   break;

  case 7:

   document.write('Fortune 7')

   break;

  case 8:

   document.write('Fortune 8')

   break;

  case 9:

   document.write('Fortune 9')

   break;

  case 10:

   document.write('Fortune 10')

Explanation:

The cookieNumber is generated using Math.random(), which is rounded to a whole number using Math.floor(). Then, a switch block is used to display a different fortune depending on the value of cookieNumber.

4 0
3 years ago
Other questions:
  • What is the operating system?
    9·1 answer
  • Sanjay is giving a slideshow presentation on his entire college class and he is feeling quite nervous in order to share his pres
    9·1 answer
  • which one of these steps describe saving a newly created file. click on the save icon. minimize the file. name the file. select
    12·2 answers
  • 3.24 LAB: Seasons
    13·1 answer
  • Copy the following code and run it. You should break it into the following 3 functions
    6·1 answer
  • Eugene wants to indent a paragraph, but the ruler is not present. Which tabs could Eugene use in order to accomplish his goal?
    14·1 answer
  • You can minimize the Ribbon with a command contained on the _____.
    7·1 answer
  • Justice wrote a program and forgot to put the steps in the correct order. Which step does she need to review?
    5·2 answers
  • Which of the following is a characteristic of vector graphics?
    15·2 answers
  • A social service agency hires accenture to improve training and experiences for caseworkers. What is one way accenture can use v
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!