Question: Pls help me write the following function in python (pls include commented explanation) Function name (8): find_index Parameters: sorted_list, target Return value: the index of

Pls help me write the following function in python (pls include commented explanation)

Function name (8): find_index Parameters: sorted_list, target Return value: the index of the target Description: Write a function called find_index that accepts two parameters, a sorted list of numbers and a target number (numbers can be integers or floats.) Use recursion to implement binary search on the sorted list of numbers and return the index of the target if it is in the list, or -1 if it is not in the list. You will not receive credit if you dont use recursion.

Test Cases (not an exhaustive list):

 >>> find_index([3, 5, 7, 9, 20], 9) 3 
 >>> find_index([4, 5, 6.2], 4) 0 

>>> find_index([1, 2, 3], 10)

-1

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!