Question: Python The first and second terms of the Fibonacci sequence are 0 and 1 respectively, thenh term (forn Fibonacci sequence Fn is given by the
The first and second terms of the Fibonacci sequence are 0 and 1 respectively, thenh term (forn Fibonacci sequence Fn is given by the following, 2) is given by the sum of the previous two terms. i.e. the Write a function Fibonacci (n), for positive integer n that retuns the n th term of the Fibonacci sequence described above, where n starts from 1I and the term is Fi 0, etc. Hint: Make sure you check that your function Fibonacci gives the correct result for n,2 as well as for all integers n >2 (3 Marks) n ): def Fibonacci(n): [ ]: | # PRE-CHECK CELL for Q3/ assert "Fibonacci in dir, "you have not defined a function naned Fibonacci assert type(Fibonacci (1))!=type(None), "Your function . Fibonacci, does not return anything." assert type(Fibonacci (3)) Iatype (None), "Your function Fibonacci does not return anything." assert type(Fibonacci(3))list, "Your function Fibonacei returns a list. It should return a single number (as either a float o inport numpy as np
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
