5 questions to test your understanding
What does `[x * 2 for x in range(5) if x % 2 != 0]` evaluate to?
A developer uses a list comprehension `[send_email(user) for user in mailing_list]` to send emails. What is wrong with this usage?
`[x ** 2 for x in numbers]` and `(x ** 2 for x in numbers)` are interchangeable — both yield the same values and behave identically.
A list comprehension `[f(x) for x in seq if pred(x)]` is semantically equivalent to a for loop that appends to a result list only when the condition is true.
What does it mean for code to be 'declarative' rather than 'imperative,' and why is this considered an advantage of list comprehensions over equivalent for loops?