The Function "median(lst)" returns the wrong value for x. It returns 4.0 instead of 4.5

I expected that it would return 4.5, because when I got the Codecademy error message "Oops, try again. median([4, 5, 5, 4]) returned 4.0 instead of 4.5", I tested the script on my computer with Python version 3.5. And it returned me the right value for x(it is 4.5). Why did the Codecademy Python interpreter returned me a different result than the the Python 3.5 interpreter on my computer? Any hints(I said hints, not solutions.)

```
def median(lst):
y = lst
y.sort()
if len(y) % 2 != 0:
z = int(len(y) / 2)
x = y[z]
else:
z = int((len(y) / 2) - 1)
z = int(z)
x = float((y[z] + y[z+1]) / 2)
return float(x)
```