Advertisement
sissou123

Untitled

Apr 20th, 2022
963
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. Python Sort List – How to Order By Descending or Ascending
  2.  
  3. In this example, we have a list of numbers and we can use the sort() method to sort the list in ascending order.
  4.  
  5. my_list = [67, 2, 999, 1, 15]
  6.  
  7. # this prints the unordered list
  8. print("Unordered list: ", my_list)
  9.  
  10. # sorts the list in place
  11. my_list.sort()
  12.  
  13. # this prints the ordered list
  14. print("Ordered list: ", my_list)
  15. for more: https://www.clictune.com/eM8N
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement