Having tons of trouble with CODE CHALLENGE: LISTS in the computer science course

Hello! So I have completed everything in the computer science course up to this point (obviously), and I am having a lot of trouble even getting the first challenge done. I can’t wrap my head around it. I’ve looked at the solution, tried to redo it for myself, and sure I can remember the code, but I don’t understand it really… Can someone point me in the right direction? I’ve done well on every quiz, project etc…

https://www.codecademy.com/paths/computer-science/tracks/cspath-flow-data-iteration/modules/dspath-lists/lessons/python-functions-lists-cc/exercises/double-index

new_lst = lst[0:index]
    new_lst.append(lst[index]*2)
    new_lst = new_lst + lst[index+1:]
    return new_lst

After looking at it all, this is the part of the answer I don’t think I am understanding.

Thank you for all responses and help!

Hello, @levisco.

Welcome to the forums.

I gave a line by line explanation of that solution here.

If you still have questions after reviewing the linked topic, feel free to ask.

Happy coding!

1 Like

This topic was automatically closed 18 hours after the last reply. New replies are no longer allowed.