≡ Menu

Python Sorted Key

A common idiom in programming is sorting a list. Python makes this a very simple task. Python provides a built-in sorted() function that accepts an iterable type, and return a sorted list: First, try sorting a list: >>> l = [3, 2, 5 ,4, 7, 1] >>> sorted(l) [1, 2, 3, 4, 5, 7] Next, [...]

{ 14 comments }