Python insert list method - add the item to the list

If you do not want to use append() method - to append to the end of the list, instead you want to append somewhere else, then you can use the insert() method.

With the insert() method - you can provide an index and the item that you want to append.

Example:

my_list = [15, 6, 7, 8, 35, 12, 14, 4, 10]
my_list.insert(4, 25)
print(my_list)
Output:
[15, 6, 7, 8, 25, 35, 12, 14, 4, 10]