Error: median([4, 5, 5, 4]) returned 5 instead of 4.5

Can anyone tell me why it happens? Did I sort the list wrongly?

Thank you.

```
def median(sequence):
new_list = sorted(sequence)
n = len(new_list)
if n % 2 == 0:
return (new_list[n / 2] + new_list[(n / 2) - 1] )/2
else:
n % 2 != 0
return new_list[int(n/2)]
```