sorted list syntax in python code example
Example 1: sorted list python
sorted(iterable, key=None, reverse=False)
type(sorted(iterable, key=None, reverse=False)) = list
Example 2: list sort python
>>> names = ['Harry', 'Suzy', 'Al', 'Mark']
>>> sorted(names)
['Al', 'Harry', 'Mark', 'Suzy']
>>> sorted(names, reverse=True)
['Suzy', 'Mark', 'Harry', 'Al']