the median code example
Example 1: median
anyone else a highly trained programmer/mathematician/statistician
and still googling this shit?
Example 2: median
Yep i am Scary Swan
Example 3: what is median
a median is a value separating the higher half from the lower half of a data sample, a population or a probability distribution. For a data set, it may be thought of as "the middle" value.
Example 4: median
def median(arr):
if len(arr) == 1:
return arr[0]
else:
arr = sorted(arr)
a = arr[0:round(len(arr)/2)]
b = arr[len(a):len(arr)]
if len(arr)%2 == 0:
return (a[len(a)-1]+b[0])/2
else:
return a[len(a)-1]