Hi, below is result of the program

# ('DEBUG ordered list is: ', [2, 6, 8, 12, 23])

# ('MEDIAN result is: ', 8)

None

but the following error message occurs.

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

Any idea why there is an error message when the median result is correct?

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

```
Replace this line with your code.
def median(sequence):
if len(sequence)% 2 == 0 : # the number of values is even
print ("DEBUG",sequence[int(len(sequence)/2)])
print ("DEBUG",sequence[int(len(sequence)/2)]-1)
median =(sequence[int(len(sequence)/2)] + sequence[int(len(sequence)/2)]-1)/2.0
return median
else: # the number of values is odd
median = sequence[int(len(sequence)/2)]
return median
nbrList = [6,8,12,2,23]
nbrList.sort()
print("DEBUG ordered list is: ", nbrList)
print(median(nbrList))
```