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
MrRa [10]
3 years ago
10

For this problem, you will write a function standard_deviation that takes a list whose elements are numbers (they may be floats

or ints), and returns their standard deviation, a single number. You may call the variance method defined above (which makes this problem easy), and you may use sqrt from the math library, which we have already imported for you. Passing an empty list to standard_deviation should result in a ZeroDivisionError exception being raised, although you should not have to explicitly raise it yourself.
Computers and Technology
1 answer:
Evgesh-ka [11]3 years ago
3 0

Answer:

  1. import math  
  2. def standard_deviation(aList):
  3.    sum = 0
  4.    for x in aList:
  5.        sum += x  
  6.    
  7.    mean = sum / float(len(aList))
  8.    sumDe = 0
  9.    for x in aList:
  10.        sumDe += (x - mean) * (x - mean)
  11.    
  12.    variance = sumDe / float(len(aList))
  13.    SD = math.sqrt(variance)
  14.    return SD  
  15. print(standard_deviation([3,6, 7, 9, 12, 17]))

Explanation:

The solution code is written in Python 3.

Firstly, we need to import math module (Line 1).

Next, create a function standard_deviation that takes one input parameter, which is a list (Line 3). In the function, calculate the mean for the value in the input list (Line 4-8). Next, use the mean to calculate the variance (Line 10-15). Next, use sqrt method from math module to get the square root of variance and this will result in standard deviation (Line 16). At last, return the standard deviation (Line 18).

We can test the function using a sample list (Line 20) and we shall get 4.509249752822894

If we pass an empty list, a ZeroDivisionError exception will be raised.

You might be interested in
What device do e-learning applications usually use to help users with visual
Tomtit [17]
The answer is Screen Readers.
6 0
2 years ago
Describe a real or made up but possible example of a product that went through a time of scarcity. What was likely to happen to
NeX [460]

Last 2012, there was a virus which infected millions of chicken. It was known as Avian influenza or bird flu. It resulted to scarcity of eggs. As the law of supply and demand states, there is an effect on the price of a product depending on its availability. If there is a low supply and a high demand, there is an increase in price and vice versa. 

4 0
3 years ago
The max-age attribute of a cookie is specified in
defon

Answer:

seconds.

Explanation:

max-age attribute of a cookie is specified in seconds.It sets the time when the cookie will be deleted.max-age attribute is not supported by all the browser.Internet Explorer does not support max-age.Son expires is used more than max-age because it supports almost all the browsers.

6 0
3 years ago
The macro command is available on the ___ tab<br> Home<br> Insert<br> View<br> Design
nataly862011 [7]

      Answer                     : Insert tab                                              

5 0
3 years ago
Read 2 more answers
Another pitfall cited in Section 1.10 is expecting to improve the overall performance of a computer by improving only one aspect
Alexandra [31]

Answer:

<u>note:</u>

<em><u>solution is attached in word form due to error in mathematical equation. furthermore i also attach Screenshot of solution in word due to different version of MS Office please find the attachment</u></em>

Download docx
8 0
4 years ago
Other questions:
  • How do you plan to keep your personal and professional connections and activity seperate on various social media platforms?
    15·1 answer
  • The ___________ button represents the start of a hyperlink in Table of contents.
    7·1 answer
  • Write a method named quarterstodollars. the method should accept an int argument that is a number of quarters, and return the eq
    13·2 answers
  • JAVA Question!
    13·1 answer
  • _____ involves storing data and running applications outside the company’s firewall. answer grid computing parallel computing cl
    11·1 answer
  • Based on the module,
    9·1 answer
  • Write a Java program that prints out a 4x4 square (like the one below)
    11·1 answer
  • 2.cite at least 2 example on how multimedia facilitates learning​
    6·1 answer
  • A touch screen can be used as both an input device and output device. explain how this is possible
    10·1 answer
  • What type of html list will automatically place a list marker, or bullet point, indicator in front of each item? group of answer
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!