0% found this document useful (0 votes)
4 views1 page

Assignment - Recursive Exercises in Python

The document outlines a series of questions related to recursive sequences and Python functions. It includes tasks for defining functions to compute terms of sequences, generating tables of values, and analyzing provided scripts for their base conditions and outputs. Additionally, it requires the creation of recursive formulas and functions for specific sequences, along with generating their first ten terms.

Uploaded by

softmenya
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Assignment - Recursive Exercises in Python

The document outlines a series of questions related to recursive sequences and Python functions. It includes tasks for defining functions to compute terms of sequences, generating tables of values, and analyzing provided scripts for their base conditions and outputs. Additionally, it requires the creation of recursive formulas and functions for specific sequences, along with generating their first ten terms.

Uploaded by

softmenya
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Qn33a. Given the recursive relationship of a sequence as: 𝑎1 = 10, 𝑎𝑛 = 𝑎(𝑛−1) + 10 𝑓𝑜𝑟 𝑛 > 0.

Define a
Python function that compute and return the nth term of the sequence.
Qn33b. Hence, write Python statement(s) that generates and tabulates the first ten (10) terms of the sequence.
*HINT: The columns of the table should be the nth value and the corresponding term.
Terms Value
1 10
2 20 etc.

Qn39 Study the scripts below then answer the following questions:

a. What is base condition of the function?


b. What is the recurrent relation of the function?
c. Write the output generated when the for loop is executed if n = 5.
d. Describe the format of the output.

Q398a. Generate recursive nth formula for each of the following sequences:
i. 2, 4, 8, 16, 32, ...
ii. 1, 3, 7, 15, ...
iii. 2, 14, 62, ...
*HINT: (i) a1 = 2 | an = a(n-1) * 2 for n > 1

Q398b. Write the corresponding recursive Python function for each sequence.
Q398c. Hence, write Python statements to generate the first 10 terms of the sequence. *HINT: Implement the
function defined in (b) above as appropriate.

Q111a. Define a Python function that recursively generates and displays the first nth multiples of fives (5).
Q111b. Study the script below then answer the questions that follows:

i. What is the name of the function?


ii. How many parameters does the function have?
iii. State the recursive step and base condition(s) respectively.
iv. Evaluate: y(2, 5)

You might also like