The whiskers of a boxplot display information related to the spread of the dataset.

There are many different ways to plot the whiskers of a boxplot. You might see some boxplots where the whiskers extend to the minimum and maximum values. Some boxplots have whiskers that extend one standard deviation away from the mean of the data.

However, one of the most commonly used methods of drawing the whiskers is to extend them 1.5 times the interquartile range from the first and third quartile.

For example, let’s say you had a dataset where the first quartile was `4`

and the third quartile was `9`

. The interquartile range for this dataset is `5`

.

The whiskers would extend 1.5 times the length of the IQR. In this case, that is `1.5 * 5`

, or `7.5`

.

We know the whiskers extend `7.5`

units, but where do they start? They start at the edges of the box, or the first and third quartiles. In this case, the left whisker starts at the first quartile (`4`

), and extend `7.5`

units to the left. So the left whisker extends to `-3.5`

. The right whisker starts at the third quartile (`9`

) and extends to `16.5`

.

One more small detail to note — the whiskers usually don’t extend all the way to 1.5 times the IQR. Instead, they extend to the point closest to `1.5`

times the IQR in the direction of the median. This means that instead of extending to `-3.5`

and `16.5`

, the whiskers would actually extend to the first point greater than `-3.5`

and the first point less than `16.5`

.

### Instructions

**1.**

We’ve given you the first and third quartiles of the dataset. Create a variable named `iqr`

and set it equal to the interquartile range of the dataset.

Remember, the IQR of a dataset is the third quartile minus the first quartile!

**2.**

We now want to find `1.5`

times the interquartile range. Create a variable named `distance`

and set it equal to `1.5`

times `iqr`

.

**3.**

We’ll now use that distance to find the end of the whiskers. Create a variable named `left_whisker`

and set it equal to `quartile_one`

minus `distance`

.

**4.**

Create a variable named `right_whisker`

. Set it equal to `quartile_three`

plus `distance`

.

**5.**

Look at the printout. In the browser, draw the whiskers to their appropriate locations. You can scroll the right most pane to the left and right if you can’t see all of the boxplot.

Note that we’re not shortening the whiskers to the first datapoint inside 1.5 times the IQR.

Run your code and hit the “Next” button to move on.