Question: Write a function that reads a specified file containing white-space separated values and returns a tuple containing the mean, standard deviation, and median of all

 Write a function that reads a specified file containing white-space separated

Write a function that reads a specified file containing white-space separated values and returns a tuple containing the mean, standard deviation, and median of all the numbers in a specified column. That is, write the body for this function: def sum_values( filename, ncol): "n" Read white-space separated values from the file named filename and return mean, standard deviation, median of column number n col (left most column is ncol=0 ) "nn \# read file and calculate the mean, standard_deviation, median return (mean, standard_deviation, median) As a test case, if the file small.txt contains this: 123456789101112131415 Then these 2 lines of python: (mean, sd, median) = sum_values( "small.txt", ncol=0 ) print( "mean =\t ",mean, " \ nstd dev =\t ", sd, " \ nmedian =\t", median) will print this: mean=1 std dev =6 median =11

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!