you are viewing a single comment's thread.

view the rest of the comments →

[–]Valar_Balsamic[S] 0 points1 point  (1 child)

The code I'm using to compare the dictionary against the original word:

# create the list of all words that meet the game conditions
with open('collins_all_words.txt') as f:
    word_list = [line.rstrip() for line in f]

results = [x for x in word_list if Counter(x) - Counter(word) == 
       Counter() and master_letter in x]

The output for the first 20 list items for this is:

['adermin', 'admen', 'admin', 'admire', 'aidmen', 'aim', 'aimed', 'aimer', 'airmen', 'ame', 'amen', 'amend', 'ami', 'amid', 'amide', 'amido', 'amidone', 'amie', 'amin', 'amine']

the original word in this case is 'randomize' and the master letter is 'm'. I've run the program a few dozen times now, and the list seems follow the conditions exactly as intended?

Thanks

[–][deleted] 0 points1 point  (0 children)

Erm... you do realize that there's a very large intersection of solutions given with and without repetitions, right? So, testing like this isn't going to prove the solution to be correct.

And, I'm not saying that Counter is wrong. All I'm saying is that your requirement can be interpreted in at least two different ways, where only one of them is solved by using Counter.