Question: 1. Given the arithmetic sequence: -1, 4, 9, a. Write a Python recursive function that will return to the program that invokes it the nth

1. Given the arithmetic sequence: -1, 4, 9,

a. Write a Python recursive function that will return to the program that invokes it the nth term in the sequence above.

b. Write a Python program outside the function that prompts the user to enter an integer n, which represents the number of terms desired. The program will include a for loop in which the Loop Control Variable (LCV) is designated as i.

The program will invoke the function n times, each time passing the current value of the LCV and receiving back from the function the appropriate term, which the program will print using: print (Term # , i = , term ). The program will also sum the first n terms and print the sum.

c. Test the program when n = 8. d. Modify your function so that it becomes a function that will run an infinite number of times. Explain what you have done.

d. Modify your function so that it becomes a function that will run an infinite number of times. Explain what you have done.

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!