Sorting Data With Python - Real Python
Sorting Data With Python
Joe Tatusko 11 Lessons 49m basics pythonAll programmers will have to write code to sort items or data at some point. Sorting can be critical to the user experience in your application, whether it's ordering a user's most recent activity by timestamp, or putting a list of email recipients in alphabetical order by last name. Python sorting functionality offers robust features to do basic sorting or customize ordering at a granular level.
In this course, you'll learn how to sort various types of data in different data structures, customize the order, and work with two different methods of sorting in Python.
By the end of this tutorial, you'll know how to:
- Implement basic Python sorting and ordering on data structures
- Differentiate between
sorted()and.sort() - Customize a complex sort order in your code based on unique requirements
For this course, you'll need a basic understanding of lists and tuples as well as sets . Those data structures will be used in this course, and some basic operations will be performed on them. Also, this course uses Python 3, so example output might vary slightly from what you'd see if you were using Python 2.
What's Included:
- 11 Lessons
- Video Subtitles and Full Transcripts
- Translated Subtitles in 8 Languages
- 1 Downloadable Resource
- Accompanying Text-Based Tutorial
- 2 Hands-On Coding Exercises
- Q&A With Python Experts: Ask a Question
- Certificate of Completion
Downloadable Resources:
Related Learning Paths:
Start NowSorting Data With Python
11 Lessons 49m
- 1. How to Use sorted() and .sort() in Python: Overview 00:50
- 2. Sorting Numbers With sorted() 03:58
- 3. Sorting Strings With sorted() 02:57
- 4. The reverse Parameter 01:51
- 5. Passing in a key Argument 07:25
- 6. Exercise: Sort a List of Words, Longest First 08:00
- 7. The .sort() Method 04:12
- 8. Common Issues With Sorting in Python 06:21
- 9. When to Use sorted() vs .sort() 04:13
- 10. Exercise: Rank 5K Race Runners by Time 08:00
- 11. How to Use sorted() and .sort() in Python: Summary 01:20
About Joe Tatusko
Joe is a manufacturing engineer turned Pythonista with interests in data wrangling and visualization.
» More about JoeEach tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:
Dan
Joanna
Sadie
Tappan
David
Geir Arne
Aldren
Alex
Philipp
Brenda
Related Courses:
davedanger
I'm taking an MIT EDX course (6.002.X) but Real Python is my goto for detailed explanation when and where needed. This helped me "sort" out some of the nuances that they glossed over in the lecture material. Thanks! Your tutorial is very well presented, and the key = lambda x:... explanation was what I needed for a current problem set.
majid021
Thank you for explaining the difference between sort and sorted in detail with good examples. I was using both sort and sorted thinking that they don't have much difference, but after watching i got really good idea when to use what.
Thanks Joe.
Billiam
Very nicely presented. Easy to understand and follow. Thanks Joe.
Pakorn
Great tutorial, very useful, esp. the common issues section.