I want to know if there are at least 2 words from a list in a string. Some words are duplicate in the list. I would like to find two different words in the string from the list.
I tried this:
keywords = ["word1", "word1", "word1", "word2", "word3"]
r = "word4 word2 word1 word5"
for keyword in keywords:
if keyword in r:
for keyword2 in keywords:
if keyword2 in r:
if keyword2 != keyword:
status="ok"
print("here at least 2 words matching")
break