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
If you wanted to find out whether an integer contained an even number of 1 bits, which status flag would be useful
AleksandrR [38]

Answer:

The correct answer will be "Parity".

Explanation:

  • Parity seems to be a methodology that tests when information is transferred or missing or overwritten when something is transferred between one storage location to another, and then it is communicated between processors or devices.
  • It would be used whilst also contrasting the container as well as the aggregated parity to evaluate or dual inspect for inaccuracies.
8 0
3 years ago
How would you reduce or minimize the size of a "file"?
beks73 [17]
The answer is D Compress

I hope this helps
6 0
3 years ago
The term generally used to describe storage systems that function at high speeds is:
Alinara [238K]
The term to describe storage systems that function at high speeds is primary memory.
6 0
3 years ago
The incident results in huge losses of revenue as a result their mobile app service is withdrawn. Investigators discovered a vul
zlopas [31]

Answer:

The attackers used the code injection

Explanation:

<em>Because, the HMTL5 allows data and code to be mixed together, making code injection attacks possible. </em>

6 0
3 years ago
A user complains that her computer is performing slowly. She tells you the problem started about a week ago when new database so
motikmotik

Answer/Explanation:

It is best to use Performance Monitor and Process counters to observe performance.

Cheers

6 0
3 years ago
Other questions:
  • What keyboard shortcut keys selects cell A1
    12·1 answer
  • (50 points) Write a program arrays1.cthat checks if two integer arrays are different by one and only one elementwhen compared el
    5·1 answer
  • Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an in
    13·2 answers
  • What steps should Jeremy take to get himself motivated to study for the test?
    12·2 answers
  • What is the name of the newer communication protocol that is supported by Window 10's version of TCP/IP?
    11·1 answer
  • Use the drop-down menu to complete the steps for using the Goal Seek feature.
    13·2 answers
  • Why would you use a computer's secondary memory?
    12·1 answer
  • ANSWER QUICKLY!!!
    5·1 answer
  • The Linux tail command prints the last maximum n lines of a file. When writing a function that performs this function, choose th
    13·1 answer
  • TRUE/FALSE. a good with many close substitutes is likely to have relativelyelastic correct demand, since consumers can easily ch
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!