Hi Ste,

Could you please help me in making me understand what's wrong in the code?

def median(n):

length = len(n)

half_length = length / 2

```
if length % 2 == 0 and length >= 2:
n = sorted(n)
median = (n[half_length] + n[half_length -1]) / 2.0
elif length == 1:
median = n[length - 1]
else:
median = n[half_length - ]
return median
```

## ERROR MESSAGE:

Oops, try again. median([-1, 2, 6, -5, 4, 2, 9]) returned 6 instead of 2