What does the key parameter in sorted do?
Sequences and slicing
Audio flashcard · 0:15Nortren·
What does the key parameter in sorted do?
0:15
The key parameter accepts a function that is called on each element to compute a sort key. Sorting then compares the keys instead of the elements directly. For example, sorting a list of strings by length uses key equals len. The original elements are returned in the order determined by their keys.
docs.python.org