# Lists

Lists are ordered sequences that can store different object types. Lists are identified by \[] brackets. We have previously seen indexing and slicing, and these techniques work the same with lists.&#x20;

You should be able to understand the code below, based on previous exercises. In this case, **len** returns the numbers of elements in the list, not the number of characters (for example, the number 10.13 would be a single element).

<figure><img src="https://content.gitbook.com/content/waPIks0TDQHpI0Cy8Jml/blobs/hm5XWoApBgH5mQzu3UpS/image.png" alt=""><figcaption></figcaption></figure>

You can also concatenate lists.

<figure><img src="https://content.gitbook.com/content/waPIks0TDQHpI0Cy8Jml/blobs/scB5rpdjzHj3QEzVEniO/image.png" alt=""><figcaption></figcaption></figure>

Lists can also be nested; you can have lists of lists.

<figure><img src="https://content.gitbook.com/content/waPIks0TDQHpI0Cy8Jml/blobs/JBRHEb3iEQCYNxeajbVL/image.png" alt=""><figcaption></figcaption></figure>

In previous notes I explained the term immutable. I demonstrated that strings are immutable. However, lists are mutable, individual items may be indexed and selectively edited.

<figure><img src="https://content.gitbook.com/content/waPIks0TDQHpI0Cy8Jml/blobs/0eKnHtwBiLvqpCwz96X3/image.png" alt=""><figcaption></figcaption></figure>

Lists have a range of available methods, we can edit the list in place, appending items.

<figure><img src="https://content.gitbook.com/content/waPIks0TDQHpI0Cy8Jml/blobs/fKPTtv3oF98RvJnRSxeC/image.png" alt=""><figcaption></figcaption></figure>

It can be very useful to take a string of data and create a list based on the contents of that string. For example, a comma/space delimited file (CSV) if a very normal way to exchange data. You can then iterate over the individual items; we will cover that in a later walkthrough.

<figure><img src="https://content.gitbook.com/content/waPIks0TDQHpI0Cy8Jml/blobs/I81qhRxzs29tZkORQc8R/image.png" alt=""><figcaption></figcaption></figure>

## Finally

Review the methods documented [here](https://docs.python.org/3/tutorial/datastructures.html)&#x20;

Experiment with some of these methods to see how they work.
