python sort function ascending code example
Example 1: python sorted descending
sorted_list = sorted(list) # ascending (default)
sorted_list = sorted(list, reverse=True) # descending
Example 2: how to sort list in ascending order in python
# vowels list
vowels = ['e', 'a', 'u', 'o', 'i']
# sort the vowels
vowels.sort()
# print vowels
print('Sorted list:', vowels)