AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Python sort list12/28/2022 ![]() cmp specifies a custom comparison function of two arguments (iterable elements) which should return a negative, zero or positive number depending on whether the first argument is considered smaller than, equal to, or larger than the second argument.The syntax of sort() method is: mylist.sort(cmp=None, key=None, reverse=False) In this tutorial, we shall use sort() function and sort the given list in ascending or descending order. ![]() To sort a python list in ascending or descending order, you can use sort() method of List class.
0 Comments
Read More
Leave a Reply. |