This question has been answered

Please solve this function this is a relatively basic class so please doofdefstrListintstr

 the easiest way  solving this.

 delete_range(my_str:, ranges:[])->:
    """Delete specified ranges from a string.

    This function takes a string and lists of indices, and returns a new string
    with the characters between those indices deleted. You may not use the del

    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.

        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.

        str: The string with the specified indices deleted.


        >>> 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?

Answered by Expert Tutors
Step-by-step explanation
def delete_range(my_str: str , ranges: List [ int ])-> str : 'Delete specified ranges from a string. This function takes a string and lists of...
Get unstuck

204,222 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