Median


#1



median


Oops, try again. median([1]) returned [1] instead of 1


return 1


`python

Replace this line with your code.

def median(x):
v = sorted([x])
b = len(v)
if b % 2 == 0:
a = (x[b/2]) + ((x[b/2]) - 1)
d = float(a) / 2.0
return d
else:
a = len(v)/2
c = v[a]
return c


#2

figured it out thanks


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.