Quizs time.How to insert a element into a embeded list using insert method or other methed relevant? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Quizs time.How to insert a element into a embeded list using insert method or other methed relevant?

transfer a=[1,ļ¼»2,3ļ¼½] to b=[1,ļ¼»2,3,4ļ¼½] is insert method still helpful? aļ¼»1ļ¼½.insert() would work,but it is not very useful in a loop definition. Is there a more simple ā€œinsertā€ way like a.insert(ļ¼»1ļ¼½ļ¼»2ļ¼½,4) existed?

19th Oct 2017, 8:35 AM
lwluowei
1 Answer
- 1
a=[1, [2, 3], 6] a.insert( [10, 8] ,1) print (a) >>> [1, [10, 8], [2, 3], 6] a[2].insert(90, 1) print (a) >>>[1, [10, 8], [2, 6, 3], 6] let me know if it helped...
20th Oct 2017, 5:11 AM
sayan chandra
sayan chandra - avatar