#python #sicp

The general form of a list comprehension is:

[<map expression> for <name> in <sequence expression> if <filter expression>]


To evaluate a list comprehension, Python evaluates the <sequence expression> , which must return an iterable value. Then, for each element in order, the element value is bound to <name> , the filter expression is evaluated, and if it yields a true value, the map expression is evaluated. The values of the map expression are collected into a list.

If you want to change selection, open document below and click on "Move attachment"