`sorted`

returns a sorted list that points to the same values, but does not alter the orginal list.

```
>>> a = [8, 6, 3, 8, 2, 4, 3, 6, 9, 1]
>>> b = sorted(a)
>>> a
[8, 6, 3, 8, 2, 4, 3, 6, 9, 1]
>>> b
[1, 2, 3, 3, 4, 6, 6, 8, 8, 9]
>>>
```

`sort()`

, on the other hand, replaces the original list with the sorted one.

```
>>> a.sort()
>>> a
[1, 2, 3, 3, 4, 6, 6, 8, 8, 9]
>>>
```

Let’s see this played out with a list of tuples…

```
>>> a = [(7, 1), (8, 2), (5, 3), (6, 4)]
>>> a.sort()
>>> a
[(5, 3), (6, 4), (7, 1), (8, 2)]
>>>
```

We can use a key getter to sort by item in the tuple but that means writing one, or we can draw of the C library and let Python handle it.

```
>>> from operator import itemgetter
>>> a.sort(key=itemgetter(1))
>>> a
[(7, 1), (8, 2), (5, 3), (6, 4)]
>>>
```

Using `sorted`

is the way to go if we want to preserve the orginal list.

```
>>> toppings = ['pepperoni', 'pineapple', 'cheese', 'sausage', 'olives', 'anchovies', 'mushrooms']
>>> prices = [2, 6, 1, 3, 2, 7, 2]
>>> z = zip(toppings, prices)
>>> z
<zip object at 0x02EA24B8>
>>> u = list(z)
>>> u
[('pepperoni', 2), ('pineapple', 6), ('cheese', 1), ('sausage', 3), ('olives', 2), ('anchovies', 7), ('mushrooms', 2)]
>>> v = sorted(u)
>>> v
[('anchovies', 7), ('cheese', 1), ('mushrooms', 2), ('olives', 2), ('pepperoni', 2), ('pineapple', 6), ('sausage', 3)]
>>> from operator import itemgetter
>>> v = sorted(u, key=itemgetter(1))
>>> v
[('cheese', 1), ('pepperoni', 2), ('olives', 2), ('mushrooms', 2), ('sausage', 3), ('pineapple', 6), ('anchovies', 7)]
>>>
```