[Solved] Write a function named containsLetter that identifies all of the strings in a list that contain a specified letter and returns a list of those strings [closed]

[ad_1]

Is this ok ?

>>> def containsLetter(searchLetter, hulkLine):
...     return [x for x in hulkLine if searchLetter in x]
...
>>> containsLetter('i', hulkLine)
['like', "i'm"]
>>>

Or

>>> filter(lambda x: searchLetter in x, hulkLine)
['like', "i'm"]
>>>

4

[ad_2]

solved Write a function named containsLetter that identifies all of the strings in a list that contain a specified letter and returns a list of those strings [closed]