0 of 6 problems solved • 0%

Comprehensions

6 exercisesIntermediate

Read a comprehension by finding the for clause first. The expression before it supplies one result for every input that passes the optional condition.

scores = [2, 5, 8] triples = [score * 3 for score in scores if score >= 5] # triples is [15, 24]