Question: help More specifically, we will write a function myslice(values, start, stop) that takes list values and two index values start and stop, and that uses
help
More specifically, we will write a function myslice(values, start, stop) that takes list values and two index values start and stop, and that uses recursion to construct and return the equivalent of values[start:stop] - i.e., the slice of values that begins with the element at index start and that goes up to but not including the element at index stop. For example: values ['a', 'b', 'c', 'd', 'e'] myslice(values, 2, myslice(values, 1, myslice(values, 3, 4) 5) 3) # should return equivalent of values[24] # should return equivalent of values[15] # should return equivalent of values[33] >>> >>> >>> Your implementation must be recursive, and the only list operations you are allowed to use are accessing the first element of the list (values[0]) and accessing all elements except the first (values [1:]) You do not need to worry about negative or omitted index values or the use of a stride length
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
