insert | SoloLearn: Learn to code for FREE!

+1

insert

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

kazuto

1 Answer

New Answer

+1

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)