title: replace part of string based on user input python
body: <pre><code>word = hello
  dashes = '-' * len(word)
  guess = input()
  </code></pre>
  
  <p>If guess is <code>h</code> I want to replace <code>dashes[0]</code> with <code>h</code> because <code>h</code> is <code>word[0]</code> how would I check to see if <code>h</code> is in word, and then if it is, replace the appropriate <code>-</code> in <code>dashes</code> at the index guess is in <code>word</code> </p>
  
  <p>Then given another <code>input()</code> and <code>dashes</code> is now <code>h----</code> and the input is <code>l</code> do the same but so that <code>dashes</code> becomes <code>h-ll-</code></p>
  
  <p>I hope this makes sense, best I can explain it.</p>
  
  <p>I have tried the following after a guess is made and before another guess is given:</p>
  
  <pre><code>dashes = dashes.replace(dashes[word.index(guess)], guess)
  </code></pre>
  
  <p>but if <code>guess</code> is <code>h</code>, <code>dashes</code> becomes <code>hhhhh</code>
  not sure why or how to fix it. </p>