
Median
def median(s):sorted(s)
if len(s) == 1:
return s[0]elif len(s) % 2!= 0:
return s[(((len(s) +1) / 2)1)]
else:
return (s[(len(s)/2)1] +s[len(s)/2])/2.0
I am getting the median result as 5.0 instead of 4.5 for the list [4,5,5,4]
What cud be the possible error??