Trying to solve a list challenge using following while loop:
def remove_middle(my_list, start, end):
while start <= end:
my_list.pop(start)
start += 1
return my_list
print(remove_middle([4, 8, 15, 16, 23, 42], 1, 3))
Outcome of this code is supposed to be [4, 23, 42], but it turns out to be [4, 15, 23]
I just cannot figure out why…