Why doesn't 8 appear in the answer | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why doesn't 8 appear in the answer

When I insert two numbers only one appears, why? https://code.sololearn.com/c60aQ6GmepoH/?ref=app

31st Dec 2019, 10:29 PM
teresa hinkley
teresa hinkley - avatar
1 Answer
+ 5
That's not how insert works. .insert() methid takes two arguments: First argument is for the index in which you want to insert your value in Second argument is the value you are inserting Since index 8 does not exist, it will append to the end of the list.
31st Dec 2019, 10:56 PM
Aymane Boukrouh
Aymane Boukrouh - avatar