title: Length function in python is not working the way I want to
body: <p>I am newbie to programming and python. I looked online for help and I doing as they say but I think I am making a mistake which I am not able to catch. 
  For now all I'm trying to do here is: if the word matches the length that user entered with the word in the file, make a list of those words. It sort of works if I replace <code>userLength</code> with the actual number but it's not working with variable <code>userlength</code>. I need that list later to develop Hangman. </p>
  
  <p>Any help or recommendation on code will be great. </p>
  
  <pre><code>def welcome():
      print("Welcome to the Hangman: ")
      userLength = input ("Please tell us how long word you want to play : ")
      print(userLength)
  
      text = open("test.txt").read()
      counts = Counter([len(word.strip('?!,.')) for word in text.split()])
      counts[10]
      print(counts)
      for wl in text.split():
  
          if len(wl) == counts :
              wordLen = len(text.split())
              print (wordLen)
              print(wl)
  
      filename = open("test.txt")
      lines = filename.readlines()
      filename.close()
      print (lines)
      for line in lines:
          wl = len(line)
          print (wl)
  
          if wl == userLength:
  
              words = line
              print (words)
  
  def main ():
      welcome()
  
  main()
  </code></pre>