I was helping my mom with this word search app earlier while taking a break from some python tutorials and I realized -- what a perfect example of something interesting for me to work on/learn from.
Here's what I came up with, and while it works, I have to do some extra steps to figure out the words.
It seems that my double characters don't register as two, and one of them gets replaced with a non-relevant letter.
I've tried a lot of different things -- popping, removing. for character in words and not in myletters (to subtract out the difference). A lot of what I found involving this stuff were grids, and directionals, but I'm really just interested in a split list of words from my character input. Any help is appreciated.
Sidenote - I am very new to coding, so idk if this was the appropriate route. This x was x * 10 simpler than any example I could find. (Maybe why it doesn't work the way I want it to? ;p)
wordlist = open("PossibleWords.txt", "r").read().split()
myletters = input("Letters?: ").lower()
s = list()
sorted = str(myletters)
for word in wordlist:
if len(word) == len(myletters) and all(letter in word for letter in sorted):
s.append(word)
for length in s[:100]:
print(length)
Based on the OP's recent comment, it sounds like we're taking about word search. To not lose the double letters, we'll use
Counter
and compare counters:USAGE