Let’s check out some exercises that will help understand Python’s .sort() method better.
Sort the list in ascending order with .sort() method.
.sort() method will modify the actual list and sort it.
This time sort the countries in alphabetic order.
.sort() method will modify the actual list and sort it.
lst.sort(reverse = False)
Now sort the list in descending order with .sort() method.
.sort() method can be used with “reverse =” parameter.
*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