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

The following code needs to be fixed to operate the above program. We have provi

ID: 3796129 • Letter: T

Question

The following code needs to be fixed to operate the above program. We have provided what code we have. Write in python idle 3.5.

SakalouRa: csc 11osFr x (ta labs-functions fall 16 x M (na subject jeffrey du x https llsal 2. Write a function at computes the first Fibonacci sequence and retum list. Fo out Fibo the following wikipedia adide. The on gets the integer number as an input parameter, representing the number of integers in the Fbonacci sequence to be found, The unction retums a list oontaining the found integers 4, the prog should return: ifn- 0 the program should retu IO. 1, 2, 3, 5, B. 13. 21. 341 n 0 or any negative number). the program should return [1 an empty list). You need a functi that tests the tabo function wrote. The function should tost for lues ot 4, 10 and 4. You should al fibonacci function by running it Python Shel Python 3.5.2 3.5.2:4def2a2901a5, 26 2016, 10:47:25) GCC 4.2.1 (Appl build 5666) (dot 3) darwi Type copyright credits or "icenseo" for more information. RESTART s/ldip nts/csc Rhomework/hw- solutions-fall20 fib.py nainO The f bonacci numbers are 0, 1, 1, 20 The first 1a bonacci numbers are Co. 1. 1, 2 3. 5, 8 3, 21, 34] fibC-4. fib(23) 2, 3 8, 13 1, 34, 5 89, 144, 23 377, 610, 987 97 2584, 4181 711) fibce) fib(15) Ca, 1, 1, 2, 3 5, 8, 13, 21, 34, 5 89, 144, 233, 3771 Submission Your attached submission Attachments No at Select a fic from computor Choose Fie No file chosen lect files from workspace stoma: Preview craft canoel Don forgettosave or submit tent att hell. Your output will look mething like this. Show all

Explanation / Answer

Following is the updated version of your code with all the necessary changes needed to produce the output similar to one shown in the question.

#code starts from here

def fibz(n):
if n<=1:
return 1
else:
return fibz(n-1) + fibz(n-2)
  
def fib(nterms):
result = []
if nterms >0:
for i in range(nterms):
result.append(fibz(i))
print(result)
  
def main():
print("The first 4 Fibonacci numbers are ",end = "")
fib(4)
print("The first 10 Fibonacci numbers are ", end = "")
fib(10)
print("fib(-4) = []")

#code ends here

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote