Find median of [2, 5, 2, 6, 7, 3, 7, 5, 7, 0, 6, 10]
Ok, I'm encountering this weird result when performing:
l = [2, 5, 2, 6, 7, 3, 7, 5, 7, 0, 6, 10]
r = median(l)
The r becomes 11/2 which is 5.5. The median here is clearly an integer and it is 5!
Why does it return 5.5?
The list has length 12 (even). I think what sage is returning is the average of elements at positions 6 and 7, which are 5 and 6.