How can I write a lambda to check for a particular word in a list?
If we’re given some list of strings, like
lambda where each value checked is each item in the list.
From the example below, we see
x being used as each number in a
range() of numbers.
my_list = range(16) filter(lambda x: x % 3 == 0, my_list)
What we want to do here is very similar, in that our
x, or whatever you want to call it, will become each item in a list. The only difference is that our
x is going to be each word in the list. And instead of checking if
x is evenly divisible by 3, we need to check if it’s equivalent to