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 type of Microsoft Server serves as an email server?
Misha Larkins [42]
I have a feeling you're looking for Microsoft Outlook.
4 0
3 years ago
Read 2 more answers
Suppose you are given a sequence that is described by a formula, starting at index n=0. If you need to change the starting index
Arisa [49]

Answer:

n+1

Explanation:

Given

n = 0 --- starting index

Required

Change the starting index to n = 1

We have:

n = 0

To change the starting index to k, we simply rewrite as:

n+k

<em>In this case; k=1; so, the starting index will be: </em>n+1<em />

3 0
3 years ago
Sarah has entered data about football players from team A and team B in a worksheet. She enters names of players from team A wit
deff fn [24]
I believe the answer is freeze pane view

7 0
3 years ago
Read 2 more answers
Jhon bought a new printer for his desktop computer. It does not work even though he checked all the cables and cords. What do yo
ExtremeBDS [4]
Im not for sure but it might be B or C
4 0
2 years ago
Read 2 more answers
How to remove negative feedback on amazon?
Svetlanka [38]
1. go back to the feedback you submitted
2.Locate the order, and then click remove 
3.select a reason for the removal and click to remove the feedback button.

(But why would you write a rude comment in the first place to begin with?)
3 0
3 years ago
Other questions:
  • Write a program to input money in cents from user, example 12745 and display the one dollar bills and the cents. Submit source c
    12·1 answer
  • A hard disk has four surfaces (that's top and bottom of two platters). Each track has 2,048 sectors and there are 131,072 (217)
    11·1 answer
  • Gemima wants to show the amount of vitamin C a fruit salad contains in the blue cell of the table below. To do this, she needs t
    9·2 answers
  • You can access various sites on the WWW by using hyperlinks or by______. A. entering a key word for your search B. following dir
    12·2 answers
  • Communications technology and the Internet can be used to reduce the time and costs involved in disseminating financial statemen
    14·1 answer
  • In 3-5 sentences, describe how you would insert a graph in your word-processing document.
    13·1 answer
  • . What type of device is a computer? Where does it use?​
    14·1 answer
  • A palindrome is a string that reads the same both forward and backward. For example, the string madam is a palindrome. Write a p
    13·1 answer
  • Can include the 5-tuple information, which is the source and destination ip addresses, source and destination ports, protocols i
    9·1 answer
  • A signal has a wavelength of 1 11m in air. How far can the front of the wave travel during 1000 periods?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!