Can somebody please explain to me why code doesn't work.

This is my code:

```
def median(numbers):
numbers.sort()
lenght = len(numbers)
if lenght % 2 == 0:
first = numbers[lenght / 2]
second = numbers[first - 1]
even_med = (first + second)/ 2.0
return even_med
elif lenght % 2 == 1:
odd_med = numbers[(lenght-1)/2]
return odd_med
elif len(numbers) == 1:
return numbers[0]
```

I get the following error when I use this code:

`Oops, try again. median([4, 5, 5, 4]) resulted in an error: list index out of range`

Thank you in advance to anybody who can help.