Median--What is missing?


#1



https://www.codecademy.com/courses/python-intermediate-en-rCQKw/2/5?curriculum_id=4f89dab3d788890003000096


I get median([1, 34, 1, 6, 8, 0]) returned 4.5 instead of 3.5

That the function will return 3.5 and succeed

def median(source_list): 
    sorted_list = sorted(source_list)  
    if len(sorted_list) % 2 == 0: 
        middle = len(sorted_list)/2 
        left = sorted_list[middle - 1]
        right = sorted_list[middle + 1] 
        print left
        print right 
        return ((left + right)/2.0) 
    else: 
        target = len(sorted_list)/2
        return sorted_list[target]


#2
12 / 2 => 6
 6 - 1 => 5
 6 + 1 => 7

These are not adjacent indices. Just use middle and middle - 1.


#3

That did it.
I guess I kinda misinterpreted "around" :expressionless:
Thx