In the context of this exercise, how is the median different from the mean?
Although these values can sometimes be very similar to each other depending on the data, they are actually quite different and represent different concepts.
The median returns the value which lies in the center position of a sorted dataset. If the number of values is even, then it will be the average of the two middle values. This value is also known as the 50th percentile, which means that 50% of the data is less than it, and the other 50% is greater than it.
The mean, on the other hand, is the average of all the values in the dataset. This value is typically used to tell us an estimate of what value most of the data falls around. Outliers can heavily influence a mean, while outliers do not affect a median.
These values can be quite different, depending on the dataset. For example,
values = [1, 1, 1, 2, 900]
The median for this dataset is
1, while the mean is