Python sorted () Function - W3Schools
www.w3schools.com
Definition and Usage The sorted () function returns a sorted list of the specified iterable object. You can specify ascending or descending order. Strings are sorted alphabetically, and numbers are sorted numerically. Note: You cannot sort a list that contains BOTH string values AND numeric values.
Python sorted() Function - GeeksforGeeks
www.geeksforgeeks.org
To sort an iterable in descending order, set the reverse argument to True. You can sort the characters of a string and return a list. Explanation: Each character of the string is treated as an element and sorted in ascending (alphabetical) order. You can sort the elements of a tuple using sorted (), which returns a list.
Python list sort in descending order - Stack Overflow
stackoverflow.com
Since your list is already in ascending order, we can simply reverse the list. Here is another way. Especially if the data is numeric, negation can be used to sort in descending order. This is especially useful if you need to pass a sorting key anyway. For example, if the data was as follows:
sorted () | Python’s Built-in Functions – Real Python
realpython.com
The built-in sorted () function returns a new sorted list from the elements of any iterable passed to it. It provides the flexibility to sort in ascending or descending order and allows customization of the sort order through a key function: