Https://www.codecademy.com/courses/learn-python-3/lessons/python-functions-lists-cc/exercises/remove-middle

def remove_middle(lst, start, end):
before_start = lst[:start]
after_end = lst[end+1:]
new_lst = str(before_start + after_end)
return new_lst

Getting correct answer but showing error: " Remove everything between start and end (including end )"

What do you think?

What data type does your function hand back? And what data type is expected? You can try calling the function to see some result

I called the function. The code works fine. Getting the error below the code. On the right side, there is no error.

Did you read this bit:

could you answer this for me, please?

Hi, it’s expecting a list of integers i believe.
I am getting the same answer but since I have put

new_lst = str(before_start + after_end)

I think the datatype of my answer is string.

PS: sorry if it is not exactly what you are willing to know.

Seems you solved the problem?

I removed str and the error vanished.
Thanks :slight_smile:

2 Likes