Sorting Lists in Python

How to use sort() and sorted() to sort lists in Python

Luay Matalka
Towards Data Science
5 min readOct 23, 2020

--

Photo by Markus Spiske on Unsplash

In this tutorial, we will look at how to sort lists using sort() and sorted() based on different criteria in python.

Sorting a List

There are two ways to sort a list. We can either use the sort() method or the sorted() function. The sort() method is a list method and thus…

--

--

Lead Machine Learning Engineer, specializing in MLOps, with a passion for teaching.