Problem

In the earlier chapter on functions there was an exercise based on DNA searching to make a...

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.

Step-by-Step Solution

Request Professional Solution

Request Solution!

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.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 8
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT