Duble Index is exercise #4 from Advanced Python Code Challenges: Lists
Difficult Python Code Challenges involving Lists
Here is the link:
I don’t understand specifically this code block that eventually returns a list [3, 8, -20, 12]:
new_lst = lst[0:index]
Adds double the value at index to the new list
Adds the rest of the original list
new_lst = new_lst + lst[index+1:]
You must select a tag to post in this category. Please find the tag relating to the section of the course you are on E.g. loops, learn-compatibility
When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!
If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer!