[lang-ref] ( filter_with_comprehension ) ( python )
def test_filter_with_comprehension():
# [x for x in items if ...]
items = [1, 2, 3, 4, 5, 6]
r = [x for x in items if x % 2 == 0]
assert r == [2, 4, 6]
def test_filter_with_comprehension():
# [x for x in items if ...]
items = [1, 2, 3, 4, 5, 6]
r = [x for x in items if x % 2 == 0]
assert r == [2, 4, 6]