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
str1=”Good” str2=”Evening” Does the concatenation of the above two strings give back a new string or does it concatenate on the
Lena [83]

Answer:

It gives a new string

Explanation:

In programming; when two or more strings are concatenated by a concatenating operator, the result is always a new string.

From the question, we have that

str1 = "Good

str2 = "Evening"

Let's assume that + is the concatenating operator;

str1 + str2 = "Good" + "Evening" = "GoodEvening"

The result of concatenating str1 and str2 is a new string "GoodEvening" while str1 and str2 still maintain their original string value of "Good" and "Evening"

5 0
3 years ago
Creating a Numpy Array
jekas [21]
Oh my god that’s a lot did you find the answer tho???
3 0
3 years ago
Which of the following is a good precaution to take when making online purchases? (1 point)
Fantom [35]

Answer:

A.

Explanation:

A is the answer..

This is because you can use a private browser for safety precautions so no hackers would target you and steal your personal information. Also the other options make no sense at all. Option B states that you can use the same strong password for all online accounts and that's not good. It's not recommended because hackers or other people on the dark web can hack into your accounts and steal your data. Option C states that you must make sure http: and an open padlock displays on the address bar. This means that your connection is insecure and people can track you down. Option D is a good thing to do but option A is the best option overall. It's the right step to take when making online purchases <3

5 0
3 years ago
Jiwoo is a professional photographer. Identify and describe a photography scenario where Jiwoo would need to consider the ethics
jok3333 [9.3K]

Answer:

Photography ethics are the principles that guide the way we take and share photos. Why is photography ethic so important? If we don't have morality in the way we use photography, we risk Aesthetics Ethics deals with the rights and wrongs and Aesthetics deals with beauty or otherwise. When we correct, manipulate or enhance images, the factors of ethics and aesthetics must always be kept in consideration. Where Does One Draw The Line if you add or remove something there that wasn’t in the scene you have crossed from documentary to fictional art. Exceptions In other cases, the only way to present a truer representation of reality is through a composite rather than with a single exposure.

Explanation:

I hope this helps I little

7 0
3 years ago
Q1) write a brief note on desktop computer.
morpeh [17]

Answer:

→A desktop computer is designed mainly as a single user computer to solve the tasks of the end user.

→ A laptop is a personal computer with a touchpad used to move a cursor on the screen.

Explanation:

.

6 0
3 years ago
Other questions:
  • WILL GIVE BRANLYIST
    6·1 answer
  • Which situation can result in positive population growth?
    14·1 answer
  • HTTP is the protocol that governs communications between web servers and web clients (i.e. browsers). Part of the protocol inclu
    5·1 answer
  • What is the basic difference between a printer and a plotter?​
    12·1 answer
  • What is a computer OPERATING SYSTEM?
    5·1 answer
  • What is wrong with the following C++ code? How would you fix it? int sum; for (int i=0; i&lt;1000; ++i) sum += i; { printf("Sum
    5·1 answer
  • For enterprise servers, or servers accessed around the clock, SATA disks are preferred over SAS disks. True or False
    12·1 answer
  • Write a class called TextProcessor that implements the methods listed below. Your implementation may use the charAt() and length
    14·1 answer
  • In how many positions are there nucleotide differences between your query sequence and the sequence of accession AY259214.1
    12·1 answer
  • A user has become compromised as a result of visiting a specific web page, without clicking on any kind of content. What type of
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!