01 / 07
You can already do this with a comprehension
"I want everything in this list doubled." Chapter 9 turned that into a single line.
This chapter adds another way of writing it — a built-in function called map.
What it does is very nearly what a comprehension does. You learn it anyway because it turns up in other people's code. Writing it is optional; reading it is not.
numbers = [1, 2, 3]print([x * 2 for x in numbers])Result
[2, 4, 6]