As a result I get this error: Oops, try again. median() returned 6.0 instead of 1
I try this code in PyCharm and it's working, I tried couple of time with different lists and everytime it's getting me the correct result. What's wrong here?
a = [1,3,20,8,4,10] b = sorted(a) x = (len(b) // 2) def median(number): if len(b) % 2 == 1: return b[x] print b[x] else: y = (b[len(b)/2]+b[(len(b)/2)-1])/2.0 return y print y print "Median value of list",a, "is:", median(a)