;

Python Program to Print the Fibonacci Series using Recursion


Tutorialsrack 22/04/2020 Python

In the Python program, we will learn how to print the Fibonacci series using recursion.

Here is the source code to print the Fibonacci series using recursion.

Python Program to Print the Fibonacci Series using Recursion
# Python Program to Print the Fibonacci Series using Recursion

# Recursive Function Beginning
def Fibonacci_series(Number):
           if(Number == 0):
                return 0
           elif(Number == 1):
                return 1
           else:
                return (Fibonacci_series(Number - 2)+ Fibonacci_series(Number - 1))

# End of the Function

# Fibonacci series will start at 0 and travel upto below number
Number = int(input("\nEnter the Range Number: "))

# Find & Displaying Fibonacci series
for Num in range(0, Number):
    print(Fibonacci_series(Num))
Output

Enter the Range Number: 10

0

1

1

2

3

5

8

13

21

34


Related Posts



Comments

Recent Posts
Tags