Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Python Sort List – How to Order By Descending or Ascending
- In this example, we have a list of numbers and we can use the sort() method to sort the list in ascending order.
- my_list = [67, 2, 999, 1, 15]
- # this prints the unordered list
- print("Unordered list: ", my_list)
- # sorts the list in place
- my_list.sort()
- # this prints the ordered list
- print("Ordered list: ", my_list)
- for more: https://www.clictune.com/eM8N
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement