Median Function

Calculates the mean value of a sorted list


Description

The function \(Median\) returns the mean value of a sorted list.

For a list with an odd number of elements, the value of the middle element is returned as a result. If the list contains an even number of elements, the average of the two middle elements is the result.


Syntax

Median (List)

Example

a=[1,3,6,7,8]

b=[1,3,6,7,8,9]

Median(a)= 6

Median(b)= 6.5