Question: I am working on some project, and it requires me to do something like this

```
[10, 15, 17, 18]
->
[10, 12, 15, 17, 18]

```

Like this, I need to put an element in between of two elements. I did try

```
mylist = [10, 15, 17, 18]
mylist.append(mylist[-1])
for i in range(2):
    mylist[-1 * i - 2] = mylist[-1 * i - 3]
mylist[-4] = 12

```

But I don't think this is efficient, and the code will probably be messy if I put this in more sophisticated codes. Is there a function to automatically do this?

Answer: 
You can use the `insert()` method.

The usage is `list.insert(index, element)`

So for your program:

```
mylist = [10, 15, 17, 18]
mylist.insert(1, 12)

```

Will insert the number `12` into the index `1` of your list, which is the second place.
Use the `list.insert` method:

```
>>> mylist = [10, 15, 17, 18]
>>> mylist.insert(1, 12)
>>> mylist
[10, 12, 15, 17, 18]

```

Note that from a runtime perspective this is not much more efficient than what you did, but for a list of small/fixed size the runtime efficiency aspect of this isn't really worth worrying about. (For efficient insert operations on arbitrarily large lists you probably want some kind of linked list structure rather than a standard Python list.)