problem2 (Score: 0.0 / 3.0)

  1. Written response (Score: 0.0 / 1.0)
  2. Written response (Score: 0.0 / 2.0)

Before you turn this problem in, make sure everything runs as expected. First, restart the kernel (in the menubar, select Kernel$\rightarrow$Restart) and then run all cells (in the menubar, select Cell$\rightarrow$Run All).

Make sure you fill in any place that says YOUR CODE HERE or "YOUR ANSWER HERE", as well as your name and collaborators below:

In [1]:
NAME = "Ben Bitdiddle"
COLLABORATORS = "Alyssa P. Hacker"

Consider the following piece of code:

def f(x):
    if x == 0 or x == 1:
        return x
    return f(x - 1) + f(x - 2)

Part A (1 point)

Describe, in words, what this code does, and how it does it.

Student's answer Score: 0.0 / 1.0 (Top)

It computes the fibonnaci sequence.


Part B (2 points)

For what inputs will this function not behave as expected? What will happen?

Student's answer Score: 0.0 / 2.0 (Top)

Not sure.