How to Sort a List of Tuples in Python: There’s More Than One Way

Do you have to sort a list of tuples in your Python program? Are you trying to figure out if you should use sorted() or sort()? You are in the right place.

The first way to sort a list of tuples is by using the Python sorted() function that returns a new sorted list of tuples. An alternative is the list sort() method that doesn’t return a new list but

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Claudio Sabato

Claudio Sabato

I’m a Tech Lead, Software Engineer and Programming Coach. I want to help you in your journey to become a Super Developer!