This question has been answered
Question

def delete_range(my_str, ranges): """Deletefromfunctionstringandofindicesandreturnsnewstringwithcharacters

 specified ranges  a string.

    This  takes a   lists  ,   a  
     the  between those indices deleted. You may not use the del
    statement.

    NOTE: Although this question shows up on the autograder, there are NO test
    cases for it. You are responsible for creating your own test cases to make
    sure it works. You do not need to submit your testcases.

    Arguments:
        my_str (str): The string to be modified.
        ranges (list): A list of [start, end] indices. You may assume that both
            start and end are valid indices (ie. between 0 and len(my_str),
            inclusive), and that start <= end. You may further assume that the
            ranges are sorted from earliest to latest (ie. [0, 10] will come
            before [15, 20]), and that the ranges will not overlap.

    Returns:
        str: The string with the specified indices deleted.

    Examples:

        >>> s = "computer science"
        >>> indices = [[4, 8], [12, 16]]
        >>> print(delete_range(s, indices))
        comp sci

        >>> s = "Aren't you a little short for a stormtrooper?"
        >>> indices = [[20, 37]]
        >>> print(delete_range(s, indices))
        Aren't you a little trooper?

    """
Need help with this function
Answered by Expert Tutors
Step-by-step explanation
def delete_range(my_str, ranges): ' Delete specified ranges from a string. This function takes a string and lists of indices , and returns a new...
Get unstuck

261,329 students got unstuck by Course
Hero in the last week

step by step solutions

Our Expert Tutors provide step by step solutions to help you excel in your courses