Objective
Create a Python program with a generator that produces the first terms of the Fibonacci sequence.
Instructions
- Define
def fibonacci(n), which yields the firstnterms: start witha = 0andb = 1, and in each turn yieldaand doa, b = b, a + b. - Read an integer
n(at least 1). - Show the terms on one line, separated by spaces.
10
0 1 1 2 3 5 8 13 21 34
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise