Question: file input/output and function Coding Problem 4.4.3 (External resource) (3.0 polnts possible) StandardDeviation SubmitRun Grades Reset 1 #trite d function called st dev. st dev

 file input/output and function Coding Problem 4.4.3 (External resource) (3.0 polnts file input/output and function

Coding Problem 4.4.3 (External resource) (3.0 polnts possible) StandardDeviation SubmitRun Grades Reset 1 #trite d function called st dev. st dev should have one 2 #parameter, a filename. The-file win contain one integer on 3 #each line. The function should return the population standard 4 #deviation of those numbers. 5 #The formula for 6 Console output will be displayed here population standard deviation can be found here: #edge . edx.org/asset-v1 ; GTxtgt-mooc-staging1+2918. T1+type@assettblock@stdev.PNG #The formula, is a bit complex, though, and since this is a 9 CS class and not nath class, here are the steps you would 10 #take to calculat it manually: 11 # 12 # 1, Find the mean of the list. # 2 . For each data point, find the difference between that 14# p oint and the mean. to a running sun of differences that difference, and add it 16 # 4, Divide the sum of differences by the length of the 17 # list. 18 # s. Take the square root of the result 19 # 29 #You may assume for this problem that the file win contain 21 #only inte 22 #files or ines. 23 #to raise it to the 8.5 power (e.g. 2 4a 0.5 will give the 24 # 25 #HTNT: You might find this easier if you load all of the 25 #numbers into a list before trying to calculate the average 27 Either way, you're going to need to loop over the numbers 28 #at least twice: once ta calculate the mean, nce to 29 #calculate the sum of the differences 30 31 #Add your function here! 32 don't need to worry easiest way to take the s about invalid square root of 2 are sone lines of code function. 34 #delor that lill test 35 #You can 35 #function with different inputs. 37? 38 #tf your function works correctly, this will originally 39 #print 27-796302658340438 (or something around there) 4 print (st_dev sone_numbers.txt") he value of the variable(s) to test your

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!