Hi,I think this quiz content of Python-List is wrong on answer

I think the right answer is 4th. am I wrong? thank you

1 Like

Yeah, you’re trying to get Gus in the middle of the list.
That line makes it one off.
If the place of Sol working from the back of the list forward is -1…

1 Like

thank you , I think i was wrong and the quiz is right.

the right answer is “friends.insert(-2,“Gus”)”

because the .insert(index) method always insert a element BEFORE the INPUT-index.

so if we want to insert “Gus” as the middle, “Gus” will be before “Katya”,“Katya” 's index is -2.

so the final right answer is “friends.insert(-2,“Gus”)”
then “Gus” will be inserted before “Katya”(index:-2), then “Gus” will be the middle of the list.

thank you. it’s a confusing question LOL

1 Like