Question: Create a data set by generating n random numbers between 0-100. Write the generated values to a file named *.txt. This file can be overwritten
Create a data set by generating n random numbers between 0-100. Write the generated values to a file named *.txt. This file can be overwritten on each run.
Compute the mean, median, mode, variance, and standard deviation of the generated data.
For mode return the single most common datapoint from the data set. If there are multiple modes with the same value, that return the first encountered.
write all the functionalities into separate functions: mean(x), median(x), mode(x), variance(x), and std(x), where x is a list of random numbers. The x should be defined as a positional-only parameter. Add function annotation for the 5 functions
In addition, you will write an addition function, summary(n), for the entire process: generate n random values, write the generated value into a file, and print out the computed statistics with appropriate labels.
Your code should be implemented and factored so that it can be used as a module or as a standalone application.
If run as a standalone program, use your summary function to print the computed statistics with n=50.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
