Question: # 4 - attach a Python file with the answers to a , b , and c below. You should place your answer to part

#4- attach a Python file with the answers to a, b, and c below. You should place your answer to part c in a comment in the file. Python uses the syntax ''' multiline comment ''' for multiline comments. Or place a # on every line of your comment.
a) Create an iterative (using a loop) Python function that can be used to generate the Fibonacci number f(n). Example: print(Fibonacci(7)) would generate the output: 13
b) Create a recursive Python function that can be used to generate the Fibonacci number f(n). Example: print(RecursiveFibonacci(7)) would generate the output: 13
c) Which algorithm is better, the iterative or the recursive? Give several reasons to justify your answer. (HINT: What is the Big-O of each?)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!