Learn to sort data with Python's sorted() and sort()

🐍📰 How to Use sorted() and sort() in Python In this step-by-step tutorial, you'll learn how to sort various types of data in different data structures, customize the order, and work with two different ways of sorting in #Python

tl;dr: sort() mutates the list (or other mutable sequence) in place, sorted() returns (not yields) a copy in, …umm… sorted order. Also both support an option (keyword argument or "kwargs"), key=, which takes either a lambda expression or a numeric index specifying the field or criteria on which to sort).

Like
Reply

To view or add a comment, sign in

Explore content categories