Question: Exercise 1 Write a Python recursive function that accepts two integer numbers as parameters representing the width and height of a rectangle and returns the

 Exercise 1 Write a Python recursive function that accepts two integer

Exercise 1 Write a Python recursive function that accepts two integer numbers as parameters representing the width and height of a rectangle and returns the area of the rectangle. Hint: find the relationship between the area of a rectangle having a width of W and the area of a rectangle having a width of W-1 Exercise 2 Write a Python recursive function that accepts one integer number as a parameter representing the side f a square and Hint: find the relationship between the area of a square having a side of S and the area of a square having a side of S-1 returns the area of the square. Exercise 3: Write a recursive Python function that accepts as a parameter an integer number N and returns the sum of all its digits. Hint: make use of integer division and modulus. Exercise 4: Write a Python recursive function that accepts a string as a parameter and returns the reverse of that string. Hint: remove the first character of the string and add it the reverse of the rest of the string. Exercise 5: Implement the reverse function in exercise 3 using an iteration Exercise 6: (submit your solution on Moodle before 3/11/2018@23:55) Write a Python recursive function that accepts as parameters to strings strl& str2 and returns true if strl is a substring of str2, and false otherwise. Hint: check recursively if str2 starts with strl Exercise 7: Using recursion calculate the sum of all values in a list. Exercise (Challenging Exercise): Write a Python recursive function that accepts as a parameter a string str and returns all the substrings of str Hint: first generate all substrings that start with the first character, then generate recursively the substrings of the string obtained by removing the first character

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!