Quizs time.How to insert a element into a embeded list using insert method or other methed relevant? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
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 Respuesta
- 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