Python Tutorial: How to sort lists

Sorting lists and getting them in order!

Following on from on our post on how to use Python lists have you ever wondered how to sort lists for your Python project?

Our latest video on lists will go through some of the techniques available so that you can get an idea of how to structure your data and sort.

 

Getting to understand how to implement

In this latest video we will look at:

  • sort() method
  • ┬ásorted() function
  • sorting a list through a function

 

Adding in those extra bits to help make the process smoother

Have you thought about sorting ascending/descending?

  • There is also a discussion on this topic as well, and while an index is available for the list, which you may feel does not merit sorting, there could be other logical reasons to implement sorting.
  • Leaving out the reverse = True/False in the sorted method can have an impact, though if you require it left out of the list you have created, automatic ascending will be the default.

Thanks for visiting our page and don’t forget to share and or like this through the buttons provided on the page!

Data Analytics Ireland

 

Leave a Reply

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