I’m trying to create a simple program where a user enters a few letters
Enter letters: abc
I then want to run through a list of words I have in list and match and words that contain ‘a’,’b’, and ‘c’.
This is what I’ve tried so far with no luck
for word in good_words: #For all words in good words list
for letter in letters: #for each letter inputed by user
if not(letter in word):
break
matches.append(word)
If you want
allthe letters inside the word:The problem with your code is the
breakinside the inner loop. Python doesn’t have a construction to allow breaking more than one loop at once (and you wanted that)