You will write functions that take random samples from a small made-up population of travel times and collect their means. The checker tests each function.
The idea. One sample gives one mean. Many samples give many means, and their pattern is the sampling distribution. Its centre is close to the population mean, and its spread is smaller than the spread of the population.
Your tasks.
sample_mean(values, n). Take random.sample(values, n) and return its mean.many_means(values, n, repeats). Return a list of repeats sample means.share_within(means, centre, distance). Return the share of the means that lie within distance of centre.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…