Python – print fibonacci series

In this post, we will see how we can print fibonacci series of numbers in python

Logic

First two numbers are 0 and 1, and then next subsequent integer will be sum of the previous 2 numbers

Implementation

We will see 2 ways of implementation, using

  • Recursive method
  • for loop

Method1

Method2

Output

0
1
1
2
3
5
8
13
21
34

 

Content posted is based on learning or working experience, Share the post with others if find useful, Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: