inside the function "bigger()", it has returned a value--a or b.
so, why do still need "return"s before "bigger()"s in the function "median()" ?

i have tried remove all the "return" in median(a,b,c),but it prints 'None'

def bigger(a,b):
if a > b:
    return a
    return b

def biggest(a,b,c):
    return bigger(a,bigger(b,c))

def median(a,b,c):   
    if a == biggest(a,b,c):
        return bigger(b,c)     #the function "bigger()" above has returned a value,
                               #so, why still need a 'return' before bigger(b,c)?
    elif b == biggest(a,b,c):
        return bigger(a,c)
        return bigger(a,b)


if you remove the return from the bigger function call, the median function doesn't return anything, resulting in a None


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