Skip to main content

Course

Python

PythonPart 5 of 7 · Chapter 2 of 4

Building a Collection in One Line

Building a new list from an old one usually starts as three lines: an empty list, a loop, and an append. Write the same transformation as one line, and read it back exactly as fast as you wrote it.

Read first: Doing Something More Than Once


Make a free account to read on

Every chapter is free — an account lets your course progress follow you from your laptop to your phone. No payment, no trial.