Question: Python recursion problem 3. Write a recursive function recListFinder() that takes a list as a parameter and value to find in a list. The function
Python recursion problem
3. Write a recursive function recListFinder() that takes a list as a parameter and value to find in a list. The function returns True if the value is in the list and False otherwise. The only list functions you are allowed to use are len(), indexing (Ist[i] for an integer i), or slicing (Ist[i:]] for integers i and j). In particular, the function should not in any way alter the list passed as a parameter. In other words, this has to be written as a recursive function. You must compare every item in the list. You cannot use loops or methods on a list such as find or count! The following shows several sample runs of the function. You should test with other inputs as well.: >> print (recFinder([1,1)) False >>> print (recFinder ([1,2,3,4,5],3)) True >>> print (recFinder ([0,0,0,0,0,0],4)) False >>> print (recFinder ([5],5)) True >>> print (recFinder ([10,20,30,40,0,0],40)) True
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
