def median(l):

sorted(l)

if len(l)%2==0:

x=(len(l)/2)

y=(len(l)/2)+1

return (l[x]+l[y])/2.0

```
else:
x=len(l)/2
return l[x]
```

I have sort the list before beginning the 'if' condition, but it still gives me the error:

Oops, try again. median([6, 8, 12, 2, 23]) returned 12 instead of 8