Question: need this answered in python version 3.5 with comments QUESTION 4 Functions and Lists (a) (Fibonacci Sequence) Write a function fib(n) that accepts an argument,

need this answered in python version 3.5 with comments need this answered in python version 3.5 with comments QUESTION 4 Functions

QUESTION 4 Functions and Lists (a) (Fibonacci Sequence) Write a function fib(n) that accepts an argument, n, and returns the nth term in the Fibonacci sequence. For those of you that have been living under a rock in the mathematical world, here's the definition of Fibonacci's sequence: - The first and second terms are 1. - nth term is the (n-1)th term + the (n2) th term. So the 3rd term is the 1 st term + the 2 nd term, the 4 th term is the 3 rd term + the 2 nd term, etc. Thus the sequence looks like this: 1,1,2,3,5,8,13,21,. You will need to also write a short program to call and test this function. Some sample runs of the program looks like this: (b) (Fibonacci Sum) Write a second function called sum fib( m,n) that accepts (5 marks) two integer arguments m and n, and return the sum of all of numbers in the sequence between the mth and nth terms. The sum should include the mth and nth terms. This function must use the function fibO from the previous question in its definition. You will need to also write a short program to call and test this function. An example run for the case of (m,n)=(3,7) is as follows

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 Databases Questions!