Question: Write a function that computes the first n numbers in the Fibonacci sequence of numbers and returns the numbers in a list. For information about

Write a function that computes the first n numbers in the Fibonacci sequence of numbers and returns the numbers in a list. For information about Fibonacci numbers, see the following wikipedia article. The function gets the integer number n as an input parameter, representing the number of integers in the Fibonacci sequence to be found. The function returns a list containing the found integers.

For example,

if n = 4 , the program should return: [0, 1, 1, 2]

if n = 10 , the program should return: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]

if n = 0 (or any negative number), the program should return [ ] (an empty list). You need to create a main function that tests the fabonacci function you wrote. The main function should test for values of n = 4, 10 and -4. You should also test the fibonacci function by running it directly in the shell. Your output will look something like this:

Please use IDLE Python code

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!