Overview
Learning Objectives
After completing this module, you should understand
-
How Python compares numbers, booleans, and sequence data types (including strings)
-
How to use the sort() method of lists and the sorted() built-in function, and the differences between them
-
How to sort in descending order
-
How to modify sort criteria using a key function
-
How to write a key function
-
How to write a lambda expression
-
How to sort values using multiple criteria
-
How to use the min() and max() functions
-
How to write a list comprehension
-
How to filter data with a list comprehension
-
How to write a generator expression and how it differs from a list comprehension
-
How to write a set comprehension
-
How to write a dictionary comprehension
Readings
You may find it helpful to refer to the following resources:
-
van Rossum et al., Python Tutorial
-
Python documentation
-
Andrew Dalke and Raymond Hettinger: Sorting HOW TO
-
-
RealPython
-
How to Use sorted() and sort() in Python Dan Bader, dbader.org
-