A Fibonacci series of numbers in which each number is the sum of the two preceding numbers. The simplest is the series 0,1, 1, 2, 3, 5, 8, etc.
Program to display Fibonacci sequence using recursion in Python
def fibonacci_recursion(num): """function to print Fibonacci sequence using Recursion""" if num <= 1: return num else: return(fibonacci_recursion(num-1) + fibonacci_recursion(num-2)) # you can Change this value for a different result no_terms = 20 # check if the number of terms is valid or not if no_terms <= 0: print("Plese enter positive integer") else: print("Fibonacci sequence are: ") for i in range(no_terms): print(fibonacci_recursion(i))
Output:-
Fibonacci sequence are: 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181