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

I can't seem to find the error, this code is working fine in my python console and I get 4.5 but here I get this error, any help why this code is not working?

```
def median(i):
i.sort()
print(i)
if len(i) == 1:
return i[0]
elif len(i) % 2 != 0:
x = int(((len(i)+1)/2)-1)
return i[x]
else:
x = (i[int(len(i)/2)-1] + i[int(len(i)/2)])/2
return x
```