`Replace this line with your code.`

# Median

def median(numbers) :

```
x=sorted(numbers)
if len(x)%2==0 and len(x)!=1 :
k=x[len(x)/2]
j= x[(len(x)/2) -1]
return (j+k)/2.0
if len(x)%2!=0 and len(x)!=1 :
total=0
total=x[(len(x)/2) -0.5]
return total
if len(x)==1 :
return x[0]
return sorted_numbers[-1]
```

FOr some reason this says list indices must be integers not float even though i am never passing in a float as an index

**system**#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.