In the earlier chapter on functions there was an exercise based on DNA searching to make a multi_find() function. That function had two constraints that we can now remove: (i) it returned the indices in a string, and (ii) it couldn’t handle default arguments. In this exercise we will fix both.
(a) Write a string function
multi_find(some_string, sub_string [,start] [,end])where start and end are optional arguments with default values for the start and end of some_string. The start and end are interpreted as they are in slicing, that is:0 = start ≤ index < end = len(some_string)
The function should return a list of indices of occurrences of sub_string in some_string. If the substring is not found, return an empty list.
(b) Demonstrate that your string function works and that you can use it in a Boolean expression.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.