Question: my code isnt working correctly according to testing cell. can you help fix it thanks!! will rate if works Part B One more example of
my code isnt working correctly according to testing cell. can you help fix it thanks!! will rate if works Part B One more example of using global scope. The Fibonacci sequence is defined by the formula F = F -1 + F-2 along with the definitions F = F = 1. Let's make use of global scope to compute numbers from this sequence. In the cell below, implement a function iterate_fib() which uses the values of the global variables in minus one and Fn_minus_two to compute the next value in the sequence. iterate fib() should return the value F, and then change in minus one and in minus tvo 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 [10): En_minus_one - 1 Fn_minus two-1 det iterate fib() global en minus one global Inminus two result in minus one + In minus onein minus two ninus one result return result minus two ## YOUR CODE MERE In (12) Testing coll) should run without error it your implementation above work! Pnminus One - 1 in minus two-1 assort(Iterate fib) assert (iterate fib() e assert (iterate fib) Assortiterate fib) - assortiterate tiba- 2) 3) 5) B) 13) Anection TOT Traceback (most recent call last)
Step by Step Solution
There are 3 Steps involved in it
To fix your code well make sure that iteratefib correctly uses the global variables Fnminusone and F... View full answer
Get step-by-step solutions from verified subject matter experts
