From the course: Python: Recursion
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Recursive Fibonacci function in Python - Python Tutorial
From the course: Python: Recursion
Recursive Fibonacci function in Python
- [Instructor] There are some recursive algorithms which have become so famous, partly through their use in teaching about recursion, that they have become classic. One such algorithm is for finding Fibonacci numbers. Fibonacci numbers are themselves very famous, at least among mathematicians. They are a sequence of numbers which has some very interesting, surprising properties. We won't go into detail here but it's a fascinating topic to explore if you're interested. For this course you just need to know how the Fibonacci sequence works. The basic idea is that from two starting numbers, each successive term in the sequence is calculated as the sum of the previous two terms. Now some authors start at 1, some start at 0, it really doesn't matter. But if you look at the slide here you can see that if we take the 0 term and the first term, and we add them together we get the second term, which is 1. And then if we take the…