Question: python The Fibonacci sequence is a famous sequence in mathematics. The first element in the sequence is 0 and the second element is 1. The
The Fibonacci sequence is a famous sequence in mathematics. The first element in the sequence is 0 and the second element is 1. The nth element is defined as Fn=Fn1+Fn2. Implement the fib function, which takes an integer n and returns the nth Fibonacci number. Use a while loop in your solution. deffib(n): "."Returns the nth Fibonacci number. >>11b(6) >11b(1) 1 >>11b(2) 1 >f1b(3) 2 >f1b(4) 3 >11b(5) 5 >>1b(6) 8 >> 354224848179261915075 YOUR CODE HERE Use OK to test your code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
