insert | SoloLearn: Learn to code for FREE!



my_list=[(1,2,3,4) , (100,200,300)] I want to insert 400 to the first index of my_list (i mean (100,200,300) but i don't know how !help please

6/24/2017 4:25:19 PM


1 Answer

New Answer


You can use insert method. But in your list you have tuples which are immutable. If replace them to lists you can insert any data. my_list=[(1,2,3,4),[100,200,300]] my_list[1].insert(3,400) Other way: my_list[1].append(400)