Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Now, the main problem: consider the Fibonacci sequence, defined by the formula a

ID: 3751977 • Letter: N

Question

Now, the main problem: consider the Fibonacci sequence, defined by the formula along with the definitions Fo-Fi1. Lef's make use of global scope to compute numbers from this sequence. in the cell below, implement a tunction iterate fib0 which uses the values of the global variables Fn minus one and Fn minus two to compute the next value in the sequence iterate fibo should return the value F , and then change Fn minus.one and Pr.ainus two to prepare for the next time the function is called. Remember that the global keyword is needed if you're going to assign to variables outside the local scope in a function. 256) Pn minus nus_two -1 def iterate fib0: ## YOUR COE HERE

Explanation / Answer

Fn_minus_one = 1 Fn_minus_two = 1 def iterate_fib(): global Fn_minus_one global Fn_minus_two result = Fn_minus_one + Fn_minus_two Fn_minus_two = Fn_minus_one Fn_minus_one = result return result