
上QQ阅读APP看书,第一时间看更新
The sort function
Finally, let's have a built-in sort function that you can use:
z = [3, 2, 1]
z.sort()
z
So if I start with list z, which is 3,2, and 1, I can call sort on that list, and z will now be sorted in order. The output of the above code is as follows:
[1, 2, 3]