The biggest difference between the two is that one is a list method, `list.sort()`

and the other is a global function. Only `list`

objects have a `sort`

attribute.

Another difference is that `list.sort`

is *insitu* which means it does not create a copy, but sorts the list *in place*. It does not return anything (except `None`

). This is not a method to use on an object passed to a function if we wish to preserve the original order.

`sorted()`

on the other hand does create a copy and sorts that, then hands it off to the assignment variable. The original list is unaffected.

Because `sorted`

is a global function, it can take any iterable and return a sorted list from that…

```
>>> sorted((3,7,4,9,2,1,7))
[1, 2, 3, 4, 7, 7, 9]
>>> sorted({'one':1, 'two':2,'three':3,'four':4,'five':5})
['five', 'four', 'one', 'three', 'two']
>>> sorted([3,7,4,9,2,1,7])
[1, 2, 3, 4, 7, 7, 9]
>>> sorted('this is a string')
[' ', ' ', ' ', 'a', 'g', 'h', 'i', 'i', 'i', 'n', 'r', 's', 's', 's', 't', 't']
>>>
```

If we peer a little further down the rabbit hole we can learn a few more things about both the method and the function, in particular the optional arguments such as `key`

and `reverse`

but I’ll leave that for you to dig into.

Not really, since it depends upon the author’s aims and objectives. We make the choice depending on how we want things the be in the end.

If, for instance we are writing a `median`

function that takes a *sample* which has a chronological order (last on is most recent) that we wish to preserve. We would not `.sort()`

this in our function since that order would be lost. Instead,

```
s = sorted(sample)
```

where `s`

is a sorted copy of `sample`

but `sample`

is unchanged.