1# The sort() function will modify the list it is called on.
2# The sorted() function will create a new list
3# containing a sorted version of the list it is given.
4
5list = [4,8,2,1]
6list.sort()
7#--> list = [1,2,4,8] now
8
9list = [4,8,2,1]
10new_list = list.sorted()
11#--> list = [4,8,2,1], but new_list = [1,2,4,8]
12
1The primary difference between the list sort() function and
2the sorted() function is that the sort() function will modify
3the list it is called on. The sorted() function will create a
4new list containing a sorted version of the list it is given.
5... The sort() function modifies the list in-place and has no return value.