You will write your own mean and median, without the statistics module, and then a function that gives a rough word for the shape of a data set from the two averages.
The idea. The mean is the total divided by the count. The median is the middle of the sorted list, or the mean of the two middle values. Here is a rough guide. Call a data set skewed right when the mean is above the median by more than a twentieth of the range. Call it skewed left when the mean is below the median by more than that. Otherwise call it roughly symmetric.
Your tasks.
mean_of(data).median_of(data). Sort a copy first.lean(data). Return "skewed right", "skewed left" or "roughly symmetric" by the rule above.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…