title: defining a function for the HANGMAN game using a loop in python
body: <p>i am a beginner in python and would appreciate your help.</p>
  <p>I need to define a function(part of the HANGMAN GAME):</p>
  <pre><code>def show_hidden_word(secret_word, old_letters_guessed):
  </code></pre>
  <p>secret_word = a string of the word the player needs to guess.
  old_letters_guessed = a list that contains the guessed letters by the player thus far.</p>
  <p>the function needs to return a string made from letters and ' _ '. the string shows the letters from the  <em>old_letters_guessed</em> list that are in the <em>secret_word</em> string in their right place(index), and the rest of the letters the player has not guessed yet as a ' _ '.</p>
  <p><strong>its supposed to look like this:</strong></p>
  <pre><code>&gt;&gt;&gt; secret_word = &quot;mammals&quot;
  &gt;&gt;&gt; old_letters_guessed = ['s', 'p', 'j', 'i', 'm', 'k']
  &gt;&gt;&gt; print(show_hidden_word(secret_word, old_letters_guessed))
  m _ m m _ _ s
  </code></pre>
  <p>this is what ive tried to do and it doesn't work (has to be done using for/ while loop):</p>
  <pre><code>def show_hidden_word(secret_word, old_letters_guessed):
   clue = &quot;&quot;
   for letter in secret_word:
    if letter in clue == True:
     clue + letter
     clue = clue + letter
    else:
     clue + '_'
     clue = '_'+ clue
   return clue
  </code></pre>
  <p>Thank you very much!</p>