- [Narrator] In this chapter, we'll learn…about a Python language construct known as comprehensions.…These can be applied to lists, sets, and dictionaries.…Now, to understand what these are,…think back to earlier in the course…when we used the map function to derive…a new list of values from an existing list of values.…And recall that the map function takes…a function as a parameter, which is then…applied to each member of a list of values.…And then, we wrapped that call in a list function…to create a new list of values.…
Now in our example, we converted temperatures…from one scale to another using this kind of approach.…It turns out that this kind of operation…is a fairly common thing to do in Python programs.…So common, in fact, that the language itself has…a special syntax for performing these kinds of operations.…I can achieve the same result as this complex…line of code by writing the following.…First, I write the expression…that I want to apply to the values,…and this is sometimes called the output expression.…
- Truth value testing
- Template strings
- Advanced Python functions
- Advanced collections
- Advanced classes and objects
- Python comprehensions: list, dictionary, and set
Skill Level Advanced
1. Python Language Features
2. Built-In Functions
3. Advanced Python Functions
4. Advanced Collections
5. Advanced Classes and Objects
6. Using Logging
7. Python Comprehensions
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.