I get an error saying "median() resulted in an error: object of type 'NoneType' has no len()". I have tried to google and search, but did not become any wiser. I suspect that it has to do with numbers being counted as empty after numbers=numbers.sort(). I did also try to create a separate list with sorted(numbers), but I got the same error.
def median(numbers): numbers=numbers.sort() median_value=0 if len(numbers) == 1: median_value=numbers elif (len(numbers) % 2) == 1: median_value=numbers[len(numbers)/2] elif (len(numbers) % 2) == 0: median_value=float((numbers[(len(numbers)/2)]+(numbers[(len(numbers)/2)+1]))/2) print median_value return median_value