Please writing as Hmmm program Using quick reference below 3
Please writing as Hmmm program
 Using quick reference below
 3. Write a Hmmm program, recFibonacci.ha, that prompts for a number n, and prints the nth Fibonacci number (where the 1st is 1 and the second is 1). Here you should implement a recursive routine to compute this. Again, if n0, print 0. So, the behavior should be the same as for loopFibonacci.ha, but it should be implemented with the recursive function we saw in Python: should be implemented with the recursive finion weswin Python. def fib(n): return 8 return 1 return fib(n-2)fib(n-1) elif n Solution
# Python program to display the Fibonacci sequence up to n-th term using recursive functions
def recur_fibo(n):
 \"\"\"Recursive function to
 print Fibonacci sequence\"\"\"
 if n <= 1:
 return n
 else:
 return(recur_fibo(n-1) + recur_fibo(n-2))
# Change this value for a different result
 nterms = 10
# uncomment to take input from the user
 #nterms = int(input(\"How many terms? \"))
# check if the number of terms is valid
 if nterms <= 0:
 print(\"Plese enter a positive integer\")
 else:
 print(\"Fibonacci sequence:\")
 for i in range(nterms):
 print(recur_fibo(i))

