how to sort a list in numerical order python code example
Example 1: 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)
Example 2: sort an array python
#List
myList = [1,5,3,4]
myList.sort()
print(myList)
#[1,3,4,5]
Example 3: sort a list numbers in python
numbers = [1, 5, -2, 4]
numbers.sort()
print(numbers)