You will write two quick checks of a data set: the mean against the median, and the share within standard deviations. Then you will write a function that decides whether the data look normal. The checker uses two made-up data sets made with a fixed seed.
The idea. For a normal shape, the mean and the median are close, about of the values lie within one standard deviation and about within two. Use the population standard deviation, statistics.pstdev.
Your tasks.
share_within(data, k).mean_minus_median(data), measured in standard deviations: .looks_normal(data). Return True only when three things hold. The share within sd is from to . The share within sd is from to . The mean minus the median is less than sd either way.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…