Oops, try again. median([4, 5, 5, 4]) resulted in an error: list indices must be integers, not float

I don't know what's wrong with my code I should return the proper number but for some reason it just gives the error message

```
def median(x):
s = sorted(x)
l = len(x)
r = 0
if l == 1:
return s[0]
elif l % 2 == 0:
m = s[l / 2.0]
d = s[l / 2.0 - 1]
r = m + d
return r / 2
elif l % 2 != 0:
r = s[l / 2]
return r
```