Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started