Super learner
This user is a Super Learner. To become a Super Learner, you need to reach Level 8.
Posted on:

02 Dec 2022

1

My answer to question 7

I actually like my solution to question 7 more than the one provided as it is using list characteristics in an elegant way:


num = 20 # number of fibonacci numbers required
fib = [0, 1] # first two gibonacci numbers
for i in range(3, num+1):
    fib.append(fib[-1]+fib[-2]) # it is always the sum of the last two
print(fib)
0 answers ( 0 marked as helpful)

Submit an answer