In mathematics, the median is the middle value in a list of numbers when the numbers are arranged in order. If there is an odd number of values, the median is the number exactly in the middle. If there is an even number of values, the median is the average of the two middle numbers.
Here's how you find the median:
Arrange the numbers in order, either ascending (smallest to largest) or descending (largest to smallest).
If the total number of values is odd, the median is the number in the middle.
If the total number of values is even, the median is the average of the two middle numbers.
Examples:
For the list [1, 3, 5], the median is 3 because it's the middle value.
For the list [1, 2, 3, 4, 5, 6], the median is (3 + 4) / 2 = 3.5, because it's the average of the two middle numbers.