Module 6 Assignment Question 1 (20 Points) The Fibonacci sequence starts 1, 1, 2, 3, 5, 8,... Each number in the sequenc

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Module 6 Assignment Question 1 (20 Points) The Fibonacci sequence starts 1, 1, 2, 3, 5, 8,... Each number in the sequenc

Post by answerhappygod »

Module 6 Assignment Question 1 20 Points The Fibonacci Sequence Starts 1 1 2 3 5 8 Each Number In The Sequenc 1
Module 6 Assignment Question 1 20 Points The Fibonacci Sequence Starts 1 1 2 3 5 8 Each Number In The Sequenc 1 (26.28 KiB) Viewed 9 times
Module 6 Assignment Question 1 (20 Points) The Fibonacci sequence starts 1, 1, 2, 3, 5, 8,... Each number in the sequence (after the firs sum of the previous two. Example: 1+1=2 2+3=5 5+8=13 and so on Convert the following algorithm into code for Fibonacci sequence. Use appropriate variab and loops as desired. Approximate answers will be given full credit. Algorithm (Using Recursion): * Function for nth Fibonacci number (This "nth" number is the las the series. Example: If your Fibonacel series is: 0,1,2,3,5,8,13. Then 13 is the "ath" number for you since 13 is the last number sequence. def Fibonacci (n) : Check if input is 0 if input in 0, print incorrect input if n < 0: print("Incorrect input") * Check if n is 0 then it will return 0 elif n - 0: return 0 Check if n is 1,2 it will return 1 elit n - 1 or n - 2: return 1 else: return Fibonacci (n-1)+ Fibonacci (n-2) Output: print (Fibonacci (5)) Your output should be: 0,1,2,3,5. (Since its 5 numbers)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply