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()"?
<p>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()"?
Here is the code:</p>

<pre><code>def bigger(a,b):
    if a &gt; b:
        return a
    else:
        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)
    else:
        return bigger(a,b)
</code></pre>

<p>I'll try to explain with examples, maybe it is simpler. </p>

<p>You have defined your <code>bigger</code> function, that returns a value, right?</p>

<pre><code>def bigger(a,b):
    if a &gt; b:
        return a
    else:
        return b
</code></pre>

<p>Now, you have defined a <code>biggest</code> function, and you are calling <code>bigger</code> from that function.</p>

<pre><code>def biggest(a,b,c):
    return bigger(a,bigger(b,c))
</code></pre>

<p>Now imagine the thousands of stuff that you could do with the value returned from <code>bigger</code>.</p>

<p>You could use the <strong>returned value</strong> from <code>bigger</code> anywhere within <code>biggest</code> function. For example:</p>

<pre><code>def biggest(a,b,c):
    some_var = bigger(a,bigger(b,c))
    return some_var + 10
</code></pre>

<p>Or</p>

<pre><code>def biggest(a,b,c):
    list_of_values = []
    list_of_values.append(bigger(a,bigger(b,c)))
</code></pre>

<p>But as you wish to use the value returned from <code>bigger</code> in the function that calls <code>biggest</code> , you should return that again so that the caller of <code>biggest</code> gets this value. Otherwise, it would get <code>None</code> which basically tells the caller "No value returned."</p>

python return