Here you will get python program to print fibonacci series using for loop.
A series in which next term is obtained by adding previous two terms is called fibonacci series. For example 0, 1, 1, 2, 3, 5, 8 . . . .
Python Program to Print Fibonacci Series
num = int(input("enter number of digits you want in series (minimum 2): ")) first = 0 second = 1 print("\nfibonacci series is:") print(first, ",", second, end=", ") for i in range(2, num): next = first + second print(next, end=", ") first = second second = next
Output
enter number of digits you want in series (minimum 2): 6
fibonacci series is:
0 , 1, 1, 2, 3, 5,
Comment below if you have any queries regarding above python fibonacci series program.
Using for loop can you solve..?
wow
I need this code using class
Its broken it just spews 1s