Skip to content

Python code snippet – How to sort in greatest to least ?

myList1 = [1, 2, 3, 4, 5]

# inplace sort() greatest to least

# deep copy sorted() greatest to least
myList2 = sorted(myList1, reverse=True)
See also  Python code snippet - How to pre populate field flask wtforms?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.