Fibonacci calculated columns

Fibonacci calculated columns

1,1,2,3,5,8 ... shaped like number of columns, called Fibonacci number. This series is characterized by starting from the third number, each number is equal to the sum of the previous two numbers.

Please use the program
with functions for calculating Fibonacci number is the value of an item, and the calculated result is returned.

def fbi(num):
    rList=[1,1,""]
    for i in range(2,num):
        rList[i]=rList[i-1]+rList[i-2]
        rList.append(rList[i])
    return rList[num]
print(fbi(4))
Published 74 original articles · won praise 25 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_43191251/article/details/104355883