list sort methods python code example
Example 1: python sort list
vowels = ['e', 'a', 'u', 'o', 'i']
vowels.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']