≡ Menu

Python Sort List

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: 1. Standard Sorting First, try sorting a list: >>> l = [3, 2, 5 ,4, 7, 1] >>> sorted(l) [1, 2, 3, 4, [...]

{ 15 comments }