Created a file for the insert method (#26496)

* Created a file for the insert method

I tried to adopt your style of making these files in order to retain consistency.

* Rename list-insert-method to list-insert-method.md

* Rename guide/english/python/lists/list-insert-method.md to guide/english/python/lists/list-insert-method/index.md

* Added code formatting, changed more info link
This commit is contained in:
JawnsenTrain
2019-02-11 15:39:33 -06:00
committed by Manish Giri
parent 84324e704b
commit 444fcbd578

View File

@ -0,0 +1,23 @@
---
title: List Insert Method
---
## List Insert Method
The method `insert(i,x)` inserts a given value `x` into the list at index `i`. The index must be within the bounds of the list
(from `0` to the length of the list minus 1).
#### Example Usage
```py
numbers = [1, 2, 3, 4, 5]
numbers.insert(3,8)
print(numbers)
```
#### Output
```
[1, 2, 3, 8, 4, 5]
```
The value `8` is inserted into the list at position `3`.
#### More Information:
- [Python Docs: Lists](https://docs.python.org/3.6/tutorial/datastructures.html#more-on-lists)