Hey, internet mates here we are going to make a python program to generate the Fibonacci series up to the given terms. To understand the program code of Fibonacci we first have to understand, what is Fibonacci series?
The series in which the next number is found by adding up two numbers before it. The simple mathematical equation to describe it is Xn+2=Xn+1+Xn.
The below program depicts how we use different variables and functions to print the Fibonacci Series for the desired range. First, we define a function with three inputs x,y,z. After defining the function we use if with proper conditions. Outside the function, we write code to ask the user for the no of terms. Then we call the function for our desired result.
Program code:- def fibo(z,x,y): if x>0: d=y+x print(d) i=d y=x x=i fibo(z-1,x,y) z=int(input("Enter no:-")) print(0) print(1) fibo(z-2,1,0)
Thank You For Coming Here 🙂.