Answers for "Write a Python Program to Display Fibonacci Sequence Using Recursion?"

5

fibonacci series python recursion

# By recursion
def fib(n):
    if n == 1 or n == 2:
        return 1 
    else:
        return(fib(n-1) + fib(n-2))
        
n = 6
for i in range(1,n+1):
    print(fib(i))
Posted by: Guest on July-24-2021

Code answers related to "Write a Python Program to Display Fibonacci Sequence Using Recursion?"

Python Answers by Framework

Browse Popular Code Answers by Language