Answers for "recursive function is also fibonacci python"

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 "recursive function is also fibonacci python"

Python Answers by Framework

Browse Popular Code Answers by Language