title: Python: Trying to loop through a string to find matching characters
body: <p>I am trying to create a simple "guess the word" game in Python. My output is something like:</p>
  
  <pre><code>String: _____ _____
  Guess a word: 'e'
  
  String:_e__o __e_e
  Guess a word: 'h'
  
  (and so on)
  
  String: hello there 
  </code></pre>
  
  <p>I have a function to do this, and within this function I have this code:</p>
  
  <pre><code>def guessing(word):
      count = 0
      blanks = "_" * len(word)
      letters_used = "" #empty string 
  
      while count&lt;len(word):
          guess = raw_input("Guess a letter:")
          blanks = list(blanks)
          #Checks if guesses are valid
          if len(guess) != 1:
              print "Please guess only one letter at a time."
          elif guess not in ("abcdefghijklmnopqrstuvwxyz "):
              print "Please only guess letters!"
  
          #Checks if guess is found in word
          if guess in word and guess not in letters_used:
              x = word.index(guess)
              for x in blanks:
                  blanks[x] = guess
              letters_used += guess 
              print ("".join(blanks))
              print "Number of misses remaining:", len(word)-counter
              print "There are", str(word.count(guess)) + str(guess)   
  </code></pre>
  
  <p><code>guess</code> is the raw input I get from the user for a guess, and <code>letters_used</code> is just a collection of guesses that the user has already input. What I'm trying to do is loop through blanks based on the <code>word.index(guess)</code>. Unfortunately, this returns:</p>
  
  <pre><code>Guess a letter: e
  e___
  Yes, there are 1e
  </code></pre>
  
  <p>Help would be much appreciated!</p>