title: Python find words within a user input word game
body: <p>I'm trying to write a program that allows the user to input a word then find all words of length 4 or greater hidden within that word that are in a word text file. So far my code can detect the words in the user inputted word that aren't jumbled. For example if I type in <code>houses</code>, the output will show <code>house</code>, <code>houses</code>, <code>ho</code>, <code>us</code>, <code>use</code>, <code>uses</code>. It should also recognize <code>hose</code>, <code>hoses</code>, <code>shoe</code>, <code>shoes</code>, <code>hues</code>, etc. </p>
  
  <p>I know itertools is the simplest solution but I want to use a different method using only loops, dictionaries, and lists. </p>
  
  <p>Here is my code so far:</p>
  
  <pre><code>def main():
      filename = open('dictionary.txt').readlines()
      word_list = []
      for line in filename:
          word_list.append(line.strip())
  
      print 'Lets Play Words within a Word!\n'
      word = raw_input('Enter a word: ')
      words_left = 0
      for words in word_list:
          letters = list(words)
          if words in word:
              print words
              words_left += 1
          else:
              False
  </code></pre>
  
  <p>The output format I'm trying to create should look like so:</p>
  
  <pre><code>Lets play Words within a Word!
  
  Enter a word: exams #user inputted word
  
  exams ---  6 words are remaining
  &gt; same #user types in guess
  Found!  # prints 'Found!' if above word is found in the dictionary.txt file
  
  exams ---  5 words are remaining
  &gt; exam
  Found!
  
  exams ---  4 words are remaining
  &gt; mesa
  Found!
  
  exams ---  3 words are remaining
  &gt; quit() #if they type this command in the game will end
  </code></pre>
  
  <p>So my question is, after entering the base word (in the ex it's EXAMS), how do I determine the total number of words within that word and if the user inputted word guesses are in the text file? Also print if the word was found. </p>