Median


#1



Saying invalid syntax line 7


def median(integers):
    sorted(integers)
    if len(integers)%2==0:
        Med=integers[len(integers)/2]+integers[len(integers)/2-1]/2.0
    else:
        Med=integers[len(integers)/2
    return Med
median([1,2,3,4,5])


#2

This needs to be assigned to a variable. The in-place method is, List.sort().


#3

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