You will write four functions that find the quartiles, the interquartile range, the outliers and the ends of the whiskers of a box plot. The helper median_of is already written. The checker uses data with an even and an odd number of values.
The idea. Split the sorted data into a lower and an upper half, and leave the median out of both halves when the number of values is odd. and are the medians of the halves. The fences are interquartile ranges beyond the quartiles, and an outlier is a value outside them.
Your tasks.
quartiles(data). Return .iqr(data).outliers(data). Return the outliers in increasing order.whisker_ends(data). Return the smallest and the largest value that are not outliers.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…