In this video, I talk about how we can apply the recursion and looping approaches to define a function that calculates the ith Fibonacci number (where i is a 0-based index number). Fibonacci numbers are numbers where the next number is the sum of the previous two (e.g., 0, 1, 1, 2, 3, 5, 8, 13, ...). We see that the recursive approach can be read almost intuitively but suffers from one major problem: the number of recursive function calls grows exponentially, which makes the function very slow for large index numbers. The looping solution, on the other hand, is a bit tricky to implement but is efficient when it comes to finding large Fibonacci numbers.
PYTHON BOOK
The lecture is based on the free book "Introduction to Python & Programming".
Get it on GitHub: https://github.com/webartifex/intro-t...
SUBSCRIBE
If you like the way I teach and talk about programming and data science, subscribe to this channel.
The videos focus on coding courses and tutorials aimed at managers and students of business administration, enabling them to make better decisions with analyses done in code.
INSTRUCTOR
Alexander Hess, PhD Student
WHU - Otto Beisheim School of Management, Vallendar, Germany
CONTACT
GitHub: https://github.com/webartifex
LinkedIn: / webartifex
XING: https://xing.to/webartifex
Facebook: / webartifex
Instagram: / webartifex
Website: http://www.webartifex.biz
YouTube: / webartifex
wa-vid-049