Im trying to find/write a function to compare two words in a Python program that solves a word puzzle game. The goal of the game is to create as many word as possible using a set of 9 letters, the words can be between 4 and 9 letters long (the words are anagrams of the original 9 letters but do not have to be 9 letters long). The set of 9 letters are read in as a string from the user. Basically the function needs to check the words in a word list (txt file which is converted to list of strings) if they are anagrams of the user inputs, and if so print word to the screen.
I have tried the python all() function but does not work since it does not take into account the frequency of characters in the user input (example: if user input contains only two A's, word should not be printed if it contains more than two A's).
You could use something like this:
If you want to know the letters of every word that are not included in the user input, you could use Counter instead: https://docs.python.org/3/library/collections.html#collections.Counter.subtract