On the same note as the median function throwing errors, I've written the following code and tested it in iPython. It works just fine there, specifically on the list [4,5,5,4], returning 4.5. However, in this console, it tells me that it's returning 4 instead of 4.5 for that list. I literally copied and %pasted the code from the Codecademy console into iPython, and there it works fine. Any ideas?
lst = sorted(lst)
if len(lst) % 2 == 0:
return (lst[int(len(lst)/2 - 1)] + lst[int(len(lst) / 2)]) / 2
return lst[int((len(lst) - 1 ) / 2)]
Note: the post doesn't save my indentations, but they are correct.