I'm getting the error "Oops, try again. median([4, 5, 5, 4]) returned 5.0 instead of 4.5"
I don't understand why this is occurring it seems to me that everything should be fine and I should be getting the correct result.
def median(list): list = sorted(list) c = len(list) if len(list) == 1: m = list return m elif len(list) % 2 == 0: a = list[(c / 2) + 1] b = list[(c / 2)] y = (a + b) / (2.0) return y else: x = list[len(list) / 2] x = x + 1 x = round(x) return x
Thanks in advance for any help