
上QQ阅读APP看书,第一时间看更新
Reverse sort
z.sort(reverse=True)
z
The output of the above code is as follows:
[3, 2, 1]
If you need to do a reverse sort, you can just say reverse=True as an attribute, as a parameter in that sort function, and that will put it back to 3, 2, 1.
If you need to let that sink in a little bit, feel free to go back and read it a little bit more.