Median

I keep getting the error that list indices should be integers and not floats. I don't know what I'm going wrong here. Can someone help me out?

```
Replace this line with your code.
def median(nums):
if len(nums) > 1:
nums = sorted(nums)
if len(nums) % 2 == 0:
middle = len(nums)/2.0
result = (nums[middle] + nums[middle - 1])/2.0
return result
else:
result = nums[(len(nums) + 1)/2.0]
return result
else:
return nums[0]
```