iteration without a loop in python
<p>The following example is from "Think Python" book by Allen Downey. While explaining the concept of "Memos" in dictionaries, he quotes the following example.</p>

<pre><code>known = {0:0, 1:1}
def fibonacci(n):
    if n in known:
        return known[n]
    res = fibonacci(n-1) + fibonacci(n-2)
    known[n] = res
    return res
fibonacci(5)
print known
</code></pre>

<p>I was expecting this code to return <code>{0:0, 1:1, 5:5}</code> since I don't see any iteration to compute the function for each value between 1 and 5. But what I see is <code>{0: 0, 1: 1, 2: 1, 3: 2, 4: 3, 5: 5}</code> returned when the code is run (as the book says it would), but I can't understand why the function computed expression <code>res = fibonacci(n-1) + fibonacci(n-2)</code> for n=2, n=3 and n=4. </p>

<p>Can someone please explain this to me? I can't quite get the explanation in the book.</p>