Why does index= -1 inserts "java" at 2nd last position? (As generally​ index = -1 means end of list( | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why does index= -1 inserts "java" at 2nd last position? (As generally​ index = -1 means end of list(

https://code.sololearn.com/cH58M41r43e9/?ref=app

9th Jun 2018, 12:57 PM
Sandeep Singh
Sandeep Singh - avatar
3 Answers
+ 1
That is because .insert() inserts the object before the given index, not at it :)
9th Jun 2018, 1:43 PM
Just A Rather Ridiculously Long Username
9th Jun 2018, 4:01 PM
Sandeep Singh
Sandeep Singh - avatar
0
No problem :)
14th Jun 2018, 1:08 PM
Just A Rather Ridiculously Long Username