To get unlimited answers, .
Lesson on Medians
What is the Median?
The median of a set of numbers is the number in the middle. When an odd set of numbers is sorted, the middle number itself is the median. When an even set of numbers is sorted, the median is halfway between the two middlemost numbers. For an in-depth look at the median, see our lesson How to Find the Median.
How the Calculator Works
When the “calculate” button is clicked, the median function is triggered. First, the function filters and sorts the inputted numbers based on the comma separator. Then, it determines if the list of numbers is odd in length or even in length.
If the list of numbers is odd, it picks the middle number as the median. If the list of numbers is even, it finds the average of the two middlemost numbers.
Once the function finds the median, it displays the sorted number list and median below the “calculate” button. If any errors occur due to incorrect input syntax, it instead displays an error notice.