```
def median(x):
n = sorted(x)
is_median = 0
length = len(n)
if length % 2 == 0:
is_median = (n[length/2] + n[length/2 - 1]) / 2
else:
is_median = n[length/2]
return is_median
```

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

def median(x):

x.sorted

is_median = 0

length = len(x)

if length % 2 == 0:

is_median = (x[length/2] + x[length/2 - 1]) / 2

else:

is_median = x[length/2]

return is_median

it returns "median([1]) resulted in an error: 'list' object has no attribute 'sorted'"

please help cus i can't find the error?

i try to deal with number by index