My code for the median exercise gives the following error message.

median([4, 5, 5, 4]) resulted in an error: list index out of range

I don't know what the actual error is, or how to fix it. Any help would be greatly appreciated.

```
def median(numbers):
numbers.sort()
if len(numbers) == 1:
med = numbers[0]
if len(numbers) % 2 == 0:
first = numbers[(len(numbers)/2)]
second = numbers[(first-1)]
med = (first+second)/2
else:
reduced = len(numbers) - 1
med = numbers[(reduced/2)]
return med
```