A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://holypython.com/intermediate-python-exercises/exercise-15-python-sorted-function/ below:

Improve your skills with Exercise 15: sorted() function

Let’s check out some exercises that will help understand sorted() function better.

Using sorted() function, sort the list in ascending order.


sorted() function sorts in ascending order by default.

Using sorted() function, sort the list from a to z.


sorted() function sorts in ascending order (also a to z in strings) by default.

Using sorted() function sort the list from z to a.


sorted() function sorts in ascending order (also a to z in strings) by default.

sorted() function sorts in ascending order (also a to z in strings) by default. If you’d like to reverse the sorting order you can simply set reverse parameter to True:

sorted(list, reverse=True)

lst2 = sorted(lst1, reverse = True)

*Includes 14 more programming languages, inspirational tools and 1-on-1 consulting options.

Umut Sagir

Finance & Data Science Professional,
Founder of HolyPython


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4