title: Word list from text file
body: <p>I need to create a word list from a text file. The list is going to be used in a hangman code and needs to exclude the following from the list:</p>
  
  <ol>
  <li>duplicate words</li>
  <li>words containing less than 5 letters</li>
  <li>words that contain 'xx' as a substring</li>
  <li>words that contain upper case letters</li>
  </ol>
  
  <p>the word list then needs to be output into file so that every word appears on its own line.
  The program also needs to output the number of words in the final list.</p>
  
  <p>This is what I have, but it's not working properly.</p>
  
  <pre><code>def MakeWordList():
      infile=open(('possible.rtf'),'r')
      whole = infile.readlines()
      infile.close()
  
      L=[]
      for line in whole:
          word= line.split(' ')
          if word not in L:
              L.append(word)
              if len(word) in range(5,100):
                  L.append(word)
                  if not word.endswith('xx'):
                      L.append(word)
                      if word == word.lower():
                          L.append(word)
      print L
  
  MakeWordList()
  </code></pre>