Week 6 Unit 3: Exercise

22. October 2024

Import the random library and have a look at the function gauss() which gives back a random float number. Which parameters are required? Write a function gaussian_distribution() that returns a list of 1000 random numbers with a mean of 100 and a standard deviation of 10. Invoke this function.

For the resulting list calculate and print the mean and the standard deviation using the respective functions from the statistics library. Re-run the program and observe, if the values change.

Below is the output of an example execution of the program. Note that the values of the standard derivation and the mean might be different in your case.

Mean: 100.15215154056546
Standard Deviation: 9.93532937167394

< Previous unit | Next unit > | Course Overview