I am writing a code in Python 2.7 in which I have defined a list of strings. I then want to search this list\'s elements for a set of letters. These letters must be in rando
It would be easy using set():
wordlist = ['mississippi','miss','lake','que'] letters = set('aqk') for word in wordlist: if letters & set(word): print word
Output:
lake que
Note: The & operator does an intersection between the two sets.
&