Fibonacci Series

Table of contents

No heading

No headings in the article.

The Fibonacci Series is a sequence of numbers 0, 1, 1, 2, 3, 5, ......

This series is formed by the following way

  • The first two numbers in the series are always 0 and 1.

  • The next set of numbers will come by adding the previous two numbers in the series

For example

  • First term : 0

  • Second term : 1

  • Third term = First term + Second term ( 0 + 1 = 1)

  • Fourth term = Second term + Third term (1 + 1 = 2)

. . .

Let us check a sample method for generating fibonacci series

fibonacci = [0, 1]
for i in range (0, numberOfTerms - 2):
    fibonacci.append(fibonacci[-1] + fibonacci[-2])
print(fibonacci)

The above code prints the fibonacci series upto numberOfTerms terms where n is the number of terms in the series