Skip to content
Course Workshop From Idea to Knowledge

Demo Explore two complete courses. Your reading progress is saved in this browser.

Course outline

0 of 4 lessons completed

  1. Start with a useful question
  2. The mean and median tell different stories
  3. Look at the spread before drawing a conclusion
  4. Turn a calculation into an honest answer

Lesson 4 of 4

Turn a calculation into an honest answer

Match the answer to the question

You can now calculate the mean and median and inspect the spread. The final step is to communicate a result without promising more than the data supports.

By the end of this lesson, you will choose a measure for a specific purpose, understand a general median function, and plan a small measurement project of your own.

Enable JavaScript to display this block. Its source is shown below.

flowchart TD
  accDescr: The question determines the summary. Use the mean to describe total time per visit and the median to locate the middle. Both need information about spread and the limits of the data.
  A["What is the question?"]
  B["Total time per visit"]
  C["Middle of the ordered values"]
  D["Mean: 12 minutes"]
  E["Median: 8 minutes"]
  F["Add spread and limitations"]
  A --> B
  A --> C
  B --> D
  C --> E
  D --> F
  E --> F
The question determines the summary. Use the mean to describe total time per visit and the median to locate the middle. Both need information about spread and the limits of the data.

The diagram leads from a question to a summary. If you are accounting for total time across five visits, the mean preserves the link to the total: 12 × 5 = 60. If you want the middle observation, choose the median. Either way, add that the waiting times ranged from 4 to 32 minutes.

Neither branch guarantees “I will be back within ten minutes.” Assessing future visits calls for more comparable data and knowledge of whether conditions have changed.

A median for any number of observations

This function accepts a non-empty array of numbers. It leaves the original array unchanged. For an odd number of items, it returns the middle one. For an even number, it returns the mean of the two middle values.

def median(values)
  raise ArgumentError, "Provide at least one value" if values.empty?

  sorted = values.sort
  middle = sorted.length / 2
  return sorted[middle] if sorted.length.odd?

  (sorted[middle - 1] + sorted[middle]).fdiv(2)
end

puts median([4, 6, 8, 10, 32]) # 8
puts median([10, 4, 8, 6])     # 7.0

Notice the second example: the input need not already be ordered. An empty array raises a clear error instead of pretending that the answer is 0. This course assumes that the values are numbers. Data submitted through a form would also require checks on types and allowed values.

Try it yourself

Write a short answer for someone planning a coffee break. Include the number of measurements, median, mean, longest visit, and one limitation. Try your own wording before revealing the example.

Compare your answer

For example: “Across five example measurements, the median was 8 minutes and the mean was 12. The longest visit took 32 minutes, so a ten-minute break did not accommodate every visit. This is a small, invented teaching dataset, not a forecast for a real café.”

Your own small experiment

  1. Choose a repeatable activity, such as making tea.
  2. Write down the starting point, stopping point, and unit of measurement.
  3. Collect several observations, noting changes in conditions.
  4. Calculate the mean and median. Draw bars from a shared zero or list the values in a table.
  5. Write two sentences: what the data shows, and what you still do not know.

Completing the course does not require running code. You can do the calculations by hand. When you finish, mark the lesson complete; your progress will appear in the outline and library.

The main skill in this course is more than remembering a formula. It is moving from a clearly defined measurement to an answer whose scope fits the available evidence.

Your progress

Finished studying? Mark this lesson complete when you are ready.

Course tutor

Statistics over coffee

Demo

In the local application, the assistant explains lessons and answers questions about selected passages. Conversations are disabled in this demo.