Median doesn't work on the codecademy environment


#1

I build my code in sublime text and run it using python 3. For some reason the code doesn't seem to work in the codecademy environment, but works fine in my computer. Here is the code:

If this is a bug in my code that maybe I'm not noticing I would appreciate the help. If not it could be a bug in the codecademy environment.
edited with pic so indentation is clear.



#2

@yusrighouse,
You will have to look at your code
by trying to call your median() function
with

median([1])

#3

I see what you mean. I tried it on my pc and a list of 1 does give problems, but easily solved by changing med.floor to med.ceil. that fixed the problem on my PC however it still doesn't work on codecademy environment


#4

Okay I fixed it. Turns out that when I divided the count i was dividing by 2 which was an integer and dividing by an integer returns an integer. What I needed to return was a float so I changed it to 2.0 and viola! works like a charm. Tanks for the help.