Python基础 · free preview

Comprehensions

Build new lists, dictionaries, and sets from existing data with one readable expression instead of a loop.

1. Overview

Overview

2. Building Lists from Lists

Building Lists from Lists

3. Filtering with Conditions

Filtering with Conditions

4. Dictionary and Set Comprehensions

Dictionary and Set Comprehensions

5. Keeping It Readable

Keeping It Readable

6. Square the Odds

Square the Odds

7. Length Filter

Length Filter

Practice this interactively

Free account · instant grading · spaced review that schedules itself.

Start this course for free