*Excercise:*

*Error message:*

Oops, try again. median([4, 5, 5, 4]) returned 4 instead of 4.5

**What did you expect:**

i expect this line, **result = s[(len(s) / 2)] + s[(len(s) / 2) -1]**, to calculate the index for the two middel values and add them togheter to later devide them by 2. however doesnt seem to work.

```
def median(x):
s = sorted(x)
result = 0
if len(s) == 1:
result = s[0]
elif len(s) % 2 == 0:
result = s[(len(s) / 2)] + s[(len(s) / 2) -1]
result /= 2
else:
result = s[(len(s) // 2) + 1 / 2]
return result
```