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 its 5th term (-8):
base: a(1)=12
recursion: a(n)= a(n -1)-5
def recursive_3(num):
if num ==12:
return 12
return recursive_3(num -1)-5
print('rec_3',recursive_3(5))
def recursive_3(num):
if num ==1:
return -5
return recursive_3(num -1)+12
print('rec_3',recursive_3(5))
def recursive_3(num):
if num ==1:
return 12
return recursive_3(num +1)-5
print('rec_3',recursive_3(5))
def recursive_3(num):
if num ==1:
return 12
return recursive_3(num -1)-5
print('rec_3',recursive_3(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!