<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">"""
Recursive implementation of the fibonacci sequence

This function should be copied into the Python Tutor.  That way you can
see how recursion affects the call stack.


Author: Walker M. White (wmw2)
Date:   October 10, 2017 (Python 3 Version)
"""

# Function Definition
def fibonacci(n):
    """
    Returns: Fibonacci number a_n
    
    Parameter n: the position to compute
    Precondition: n is a nonnegative integer
    """
    if n == 0 or n == 1:
        return 1
    
    one_back = fibonacci(n-1)
    two_back = fibonacci(n-2)
    return one_back+two_back

# Function Call
x = fibonacci(5)

</pre></body></html>