Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

neeed help new to it 10.9 (Statistics: compute deviation) Exercise 5.46 computes

ID: 3829910 • Letter: N

Question

neeed help new to it

10.9 (Statistics: compute deviation) Exercise 5.46 computes the standard deviation of numbers. This exercise uses a different but equivalent formula to compute the standard deviation of n numbers. (xi mean) deviation mean- To compute the standard deviation with this formula, you have to store the individual numbers using a list, so that they can be used after the mean is obtained Your program should contain the following functions: Compute the standard deviation of values def deviation(x) Compute the mean of a list of values def mean (x) write a test program that prompts the user to enter a list of numbers and displays the mean and standard deviation, as shown in the following sample run Programming Exercises 351 Enter numbers: 1.9 2.5 3.7 2 1 6 3 4 5 2 FEner The mean is 3.11 The standard deviation is 1.55738

Explanation / Answer

import math
def mean(x):
return sum(x)/len(x)
def deviation(x):
m = mean(x)
var = 0
for i in x:
var += (i - m)**2
var = var/(len(x) -1)
return math.sqrt(var)

def main():
data = input("Enter numbers: ")
data = data.split()
x = [float(i) for i in data]
print("The mean is " + "{0:.2f}".format(mean(x)))
print("The standard deviations is " + "{0:.5f}".format(deviation(x)))

if __name__ == '__main__':
main()

# code link: https://paste.ee/p/USdXa