Posted on:

20 Jun 2023

0

Another solutiion to Question 7

# Initiate a list with the first two numbers to be able to calculate after
fib=[0,1]
j=0

# We already have two numbers from the 20 so we loop only on 18 more 

for i in range(0,18):
    
# We add the last two numbers the add the result to the end of the list 

    j=fib[-1]+fib[-2]
    fib.append(j)

print(fib)

0 answers ( 0 marked as helpful)

Submit an answer