3 ms·
As others have said, you can use: sorted_list = sorted(my_list) sorted() also has a reverse option and a key option to specify the keys to sort by. And the
by fuzztester 3y ago
As others have said, you can use:
sorted_list = sorted(my_list)
sorted() also has a reverse option and a key option to specify the keys to sort by.
And the sort is guaranteed to be stable.
https://docs.python.org/3/library/functions.html#sorted https://docs.python.org/3/library/functions.html#sorted