When I run my code, i get the error message:
Oops, try again. median() returned 0 instead of 1
it should take a list of numbers and sort them and then return the middle number (or if the set of numbers is even, return the middle two)
I am very new to python, and all help is appreciated!
def median(x): s = sorted(x) l = len(x) r = 0 for i in s: if l % 2 == 0: r = l / 2 + l / 2 - 1 / 2.0 else: r = l / 2 return r print median([1,2,3,4,4])