Exercise: Generator for Fibonacci Numbers
Challenge yourself by creating a Fibonacci generator in this exercise.
We'll cover the following
Problem statement: Implement a generator for Fibonacci numbers
We implemented a Fibonacci series iterator in the chapter on iterators. Let’s implement it again here as a generator that generates the Fibonacci numbers.
Recap of Fibonacci series
The Fibonacci series starts with 0, then 1. Each subsequent value in the series is formed by adding the two previous values, as shown below:
Get hands-on with 1400+ tech skills courses.