Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

c. What were you expected to do when you grew up?

Answered: 1 week ago

Question

d. How were you expected to contribute to family life?

Answered: 1 week ago

Question

e. What do you know about your ethnic background?

Answered: 1 week ago