1 / 13

Not Everything Is a List

Both comprehensions so far have handed you back a list.

But think about what you have actually built in this course. A word and how long it is. A name and a score. An item and its price. Pairs, looked up by a label — which is a dictionary, not a list.

And building a dictionary with a loop has the same plumbing problem as building a list did.

The brackets decided what came out last time. Change the brackets, and you can change what comes out.