Example 79: Fibonacci Words
Learn how to generate Fibonacci words.
We'll cover the following...
We'll cover the following...
Problem
Fibonacci words are a specific sequence of binary digits. It is formed by the repeated concatenation of words.
Write a function that generates and prints the Fibonacci words of order 0 through 5.
Example
| Input | Output |
|---|---|
| f(0) | a |
| f(1) | b |
| f(2) | ba |
| f(3) | bab |
| f(4) | babba |
Try it yourself
Try to solve this question on your own in the code widget below. If you get stuck, you can always refer to the solution provided.