Hello,
can someone explain this task please?
Create a function named
remove_middle
which has three parameters namedlst
,start
, andend
.The function should return a list where all elements in
lst
with an index betweenstart
andend
(inclusive) have been removed.
and why this is the solution to it:
def remove_middle(lst, start, end):
return lst[:start] + lst[end+1:]