In this video, Josh McQuiston outlines the requirement for a programming challenge. In this challenge, learners have the opertunity to put knowledge into action, by creating a function that outputs fibonacci sequence values to a generator object. The fibonacci sequence is infinite. A generator is a good tool for iterating over infinite sequences.
- [Narrator] It's time for a challenge.…In this challenge you'll create a generator object…that will yield the Fibonacci sequence.…The Fibonacci sequence is an interesting pattern of numbers…that mathematicians have been keenly interested in…for at least 800 years.…They show up in mathematics,…they're the basis of the Golden Spiral,…and they even show up quite often in nature.…The artichoke uses the Fibonacci pattern…to spiral the sprouts of its flowers.…It's even the basis of the Fibonacci search technique,…which is a method of searching assortative array.…
While it's not an easy sequence to define mathematically,…it is a good sequence to demonstrate…the functionality of Python generators.…Because of the way the Fibonacci sequence…keeps adding upon itself,…it grows very quickly into very large numbers.…Let's take a look at the underlying math.…The sequence can be defined concisely this way,…each number in the sequence is a sum of the previous two.…21 is the sum of 13 and eight.…
13 is the sum of eight and five, and so on.…
Share this video
Embed this video
Video: Challenge: Fibonacci sequence generator