Python sorted() built-in function

From the Python 3 documentation

Return a new sorted list from the items in iterable.

Examples

>>> sorted([1, 2, 3, 7, 4])
# [1, 2, 3, 4, 7]

>>> sorted(['a', 'h', 'e'])
# ['a', 'e', 'h']

>>> sorted([1, 2, 3, 7, 4], reverse=True)
# [7, 4, 3, 2, 1]

>>> sorted(['a', 'h', 'e'], reverse=True)
# ['h', 'e', 'a']

Ups! Nothing here yet!

This is a great opportunity for you to collaborate! Hit the link at the end of this page and add some examples and a brief description. If you don't know where to start, the Python 3 documentation will lead you in the right direction.

Subscribe to pythoncheatsheet.org

Join 10.900+ Python developers in a two times a month and bullshit free publication , full of interesting, relevant links.