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
Describe the differences and similarities between the most common operating systems used for Mac, PC, and Linux in
melamori03 [73]

Answer:

well the difference is obviously the graphics cards, the fps they can run and many more, of course you can improve these by installing new operating systems compatiable for that system. you can also install graphic cards that dont necissarally go with that computer, another difference is how smoothly they can run certain programms and games.

Explanation:

6 0
2 years ago
What does DKIM stand for?
zheka24 [161]
Domain Keys Identified Mail is the answer:)
4 0
3 years ago
Read 2 more answers
Question 1
likoan [24]

Answer:

No Answer by by a third jsjshs

7 0
1 year ago
You will start by doing a bit of research on viewfinders and LCD displays on digital cameras. After you feel that you have an un
Lemur [1.5K]

Answer:

SOMEBODY ANSWER IT

Explanation:

JESUS C

3 0
3 years ago
What is the usual price of smartphone apps?
natka813 [3]

0-20 dollars

that's the usual cost for apps

and for phone it's cost

RS 32,000 Nepali rupes

you can convert it by dividing it by 110

and you will get price in dollars

8 0
3 years ago
Read 2 more answers
Other questions:
  • Here are the codes for producer and consumer problems.
    10·1 answer
  • Which skill refers to the ability to visualize and implement possible business solutions to problems?
    6·1 answer
  • Which of the following commands would you use to start the program Main with four strings? a. java Main arg0 arg1 arg2 arg3 b. j
    11·1 answer
  • Which one is the right code
    10·1 answer
  • One way to initiate a file download from a web page is to
    8·1 answer
  • 6.16 LAB: Find largest number (EO) Write a method, findMax(), that repeatedly reads in integers until a negative integer is read
    9·1 answer
  • What maintains data about various types of objects, events, people, and places?
    10·1 answer
  • Several small stores rent space within a larger shopping centre. The owners of the shopping centre have provided a physical netw
    15·1 answer
  • When can screentips be useful? when finding a tab when looking for a command when pinning the ribbon when using a command.
    8·1 answer
  • what is one category of software mentioned in the unit materials as being example of groupware English technical
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!