sort () and reverse() Methods in Python

Published: 23 January 2021
on channel: Code with Ish
643
13

This video shows how to use sort() and reverse() methods in Python ...

Definition
The sort() method sorts the list ascending by default.
You can also make a function to decide the sorting criteria(s).
reverse Optional. reverse=True will sort the list descending. Default is reverse=False

Example Code
#using sort() and reverse() methods
list = ["Book","Apple","Dog","Camel"]
list.sort(reverse=True)
print(list)