24 lines
		
	
	
		
			538 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
		
		
			
		
	
	
			24 lines
		
	
	
		
			538 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
|   | --- | ||
|  | 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) |