Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Sorting – sort()
Sorting – sorted()
9. sorted()
Sorting – reverse() and reversed()


Very well done! So far, we've worked with the sort() function, which operates in place and modifies the original list. However, we sometimes want to avoid that, so we use a similar function named sorted():


Unlike sort(), sorted() doesn't modify the original list; it returns a sorted copy. Let's check that in an exercise.


Run the template code. Note that sorted() uses a slightly different syntax than sort().

As you can see, the original list in the books variable is left untouched. The sorted list is stored in a new variable named sorted_books.