What's wrong with this code?
def remove_middle(lst, start, end):
for i in range(start, end+1):
del lst[i]
return lst
It should remove all elements place in an index between start and end(inclusive). In the example below, it should return [4, 23, 42]
but when I run the code I get [4, 15, 23]
.
print(remove_middle([4, 8, 15, 16, 23, 42], 1, 3))