# Median - code works in IDLE but not on here?

#1

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/python-intermediate-en-rCQKw/2/5?curriculum_id=4f89dab3d788890003000096

<In what way does your code behave incorrectly? Include ALL error messages.>

Oops, try again. median([4, 5, 5, 4]) returned 4 instead of 4.5

<What do you expect to happen instead?>

My code should be returning 4.5 as it does on IDLE when using the same list

```python

def median(numbers):
sort = sorted(numbers)
m = (len(sort)//2)
if len(sort)%2 == 0:
median = (sort[m-1]+ sort[m])/2
else:
median = sort[int(m)]
return median

``<do not remove the three backticks above>``

#2

changes where made to division behavior:

``````# python3
print 9 / 2 # 4.5
# python2
print 9 / 2 # 4
``````

take a guess which python version your IDLE uses and which version codecademy uses? To make it work in python2 the division should involve a float to prevent python2 from rounding down to the nearest integer

#3

Ah I see! Thanks so much for your help!

#4