Question: A recursive formula can be implemented in Python and then used to provide the nth term in a series. Which of the following recursive programs

A recursive formula can be implemented in Python and then used to provide the nth term in a series.
Which of the following recursive programs implements the recursive formula below and prints out the value of its 5th term (23):
base: a(1)=7
recursion: a(n)= a(n -1)+4
a.)
def recursive_1(num):
if num ==1:
return 7
return recursive_1(num -1)+4
print('rec_1',recursive_1(5))
b.)
def recursive_1(num):
if num ==1:
return 7
return recursive_1(num +1)+4
print('rec_1',recursive_1(5))
c.)
def recursive_1(num):
if num ==1:
return 4
return recursive_1(num -1)+7
print('rec_1',recursive_1(5))
d.)
def recursive_1(num):
if num ==4:
return 7
return recursive_1(num -1)+4
print('rec_1',recursive_1(5))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!