array sort python code example
Example 1: python sort list in reverse
list.sort(reverse=True)
sorted(list, reverse=True)
Example 2: sort array python
array = [1, 2, 3, 19, 11, 90, 0]
array.sort()
print(array)
Example 3: sort an array python
myList = [1,5,3,4]
myList.sort()
print(myList)
Example 4: sort python
>>> x = [1 ,11, 2, 3]
>>> y = sorted(x)
>>> x
[1, 11, 2, 3]
>>> y
[1, 2, 3, 11]
Example 5: sorting python array
sorted(list, key=..., reverse=...)
Example 6: python sort list
vowels = ['e', 'a', 'u', 'o', 'i']
vowels.sort()