The median is a measure of center. The middle number of a set of data is the median.
This measure is resistant.
The median is a 50th percentile (or “middle” quartile). Half of the data is below the median.
The middle number is the third score, or 7, so the median of this data is 7.
When there is an even number of numbers, there is no true value in the middle.
The median is then the mean of the two middle numbers of (5 + 8)=13/2 = 6,5.
If there are four students sitting in a row, the middle of the row is halfway between the second and third students.
def median(sequence):
isEven = True
if len(sequence) % 2 == 0:
isEven = True
else:
isEven = False
sequence.sort()
# - 1
index_average = int(round(len(sequence)/2))
if isEven:
median = (sequence[index_average-1]+sequence[index_average])/2.00
else:
median = sequence[index_average]
return median