---
title: "List Manipulation"  
description: "List Manipulation"  
author: "Anonymous User"  
published: 2018-07-06  
updated: 2018-07-07  
canonical: https://www.mindstick.com/forum/34588/list-manipulation  
category: "python"  
tags: ["python-3.4", "python"]  
reading_time: 1 minute  

---

# List Manipulation

[Explain](https://www.mindstick.com/forum/157854/what-is-system-debugging-explain-some-system-debugging-tools-used-in-modern-computer-systems) the list [manipulation](https://www.mindstick.com/blog/63649/77-727-microsoft-excel-2016-core-data-analysis-manipulation-and-presentation-exam) in [python](https://www.mindstick.com/articles/75378/simple-yet-useful-tips-when-using-python) with example ?

## Replies

### Reply by Prakash nidhi Verma

List manipulation in Python :

List is one of the simplest data structures in Python.Its very important and Lists are enclosed in square brackets [ ]. each item is separated by a comma.Every List item assign unique index no. A list is mutable, meaning you can change its contents. Lists have many built-in control functions.

Methods of List objects are:

Creation:

```
L = ['yellow', 'red', 'blue', 'green', 'black'] 
```

print L :

```
['yellow', 'red', 'blue', 'green', 'black'] 
```

Accessing/Indexing :

```
L[0]  = 'yellow' 
```

Slicing:

```
L[1:4]  = ['red', 'blue', 'green'] 
```

```
L[2:]   = ['blue', 'green', 'black']
L[:2]   =  ['yellow', 'red']
L[-1]   =  'black'
L[1:-1] = ['red', 'blue', 'green']
```

Lengthof items in list :

```
len(L)  =  5 
```

Sorting the list :

```
sorted(L) = ['black', 'blue', 'green', 'red', 'yellow'] 
```

Append to end of list:

```
L.append("pink")
```


---

Original Source: https://www.mindstick.com/forum/34588/list-manipulation

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
