Solution: Generate the First 20 Fibonacci Numbers
Learn how to generate the first 20 Fibonacci numbers.
We'll cover the following...
The solution to the problem of generating the first 20 Fibonacci numbers is given below.
Solution
Press + to interact
lst = [0, 1][lst.append(lst[k - 1] + lst[k - 2]) for k in range(2, 20)]print('First 20 Fibonacci numbers:', lst)
...