Median! I am stuck


#1



This is my code please help me. Thanks in advance.


def median(my_list):
    your_list=sorted(my_list)
    if len(your_list)==1:
        return your_list[0]
    elif len(your_list)%2==0:
        d1=your_list[len(your_list)/2-1]
        d2=your_list[len(your_list)/2]
        add=d2+d1
        return add/2
    else:
        x1=your_list[0]
        x2=your_list[len(your_list)-1]
        addition=x1+x2
        division = addition/2-1
        return your_list[position]**strong text**


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.