how to sortj a list in python code example
Example 1: how to sort a list in python
old_list = [3,2,1]
old_list.sort()
Example 2: list sort python
>>> names = ['Harry', 'Suzy', 'Al', 'Mark']
>>> sorted(names)
['Al', 'Harry', 'Mark', 'Suzy']
>>> sorted(names, reverse=True)
['Suzy', 'Mark', 'Harry', 'Al']