Now that we’ve found Q2, we can use that value to help us find Q1 and Q3. Recall our demo dataset:

c(108,4,8,15,16,23,42)c(-108, 4, 8, 15, 16, 23, 42)

In this example, Q2 is 15. To find Q1, we take all of the data points smaller than Q2 and find the median of those points. In this case, the points smaller than Q2 are:

c(108,4,8)c(-108, 4, 8)

The median of that smaller dataset is 4. That’s Q1!

To find Q3, do the same process using the points that are larger than Q2. We have the following points:

c(16,23,42)c(16, 23, 42)

The median of those points is 23. That’s Q3! We now have three points that split the original dataset into groups of four equal sizes.



Find the first quartile of dataset_one and store it in a variable named dataset_one_q1.


Find the third quartile of dataset_one and store it in a variable named dataset_one_q3.


Find Q1 and Q3 of dataset_two. Store the values in variables named dataset_two_q1 and dataset_two_q3.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?