Remember that the expression
Note also that a filter can be neatly expressed as a list comprehension:
"a" and "c"
is a Boolean expression that actually evaluates to "c"
(per the documentation), so your filter only keeps the items containing "c"
.Note also that a filter can be neatly expressed as a list comprehension:
values = ["bc", "ad", "ac", "cpd"] filtered_values = [v for v in values if "a" in v and "c" in v]