looking for some solutions? You are welcome.

SOLVED: Python3. How to check if a suffix is in some of the words in a list?


I am using python3 and coming across this question. Say I have a list

L = ["money", "fame", "popularity"]

I want to check if there is any word in L contains "pop". I know that if L is a string, e.g. if L = "I want to be popular", then I can just do "pop" in l, and the boolean value will be returned. But now L is a list, how can I check if any word in this list contains "pop" then? (not using a loop if possible)

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots

No comments: