title: How to replace dash with letter - hangman
body: <p>I am trying to make a hangman game for class and I am stuck on how to replace a dash (-) with a correctly guessed letter.</p>
  
  <p>Like if the  word was HAPPY and  the  user guessed the letter p, so it would replace the  dash for a letter and look like this: --PP-</p>
  
  <p>Here is my code so far:</p>
  
  <pre><code>def play_game(secret_word):
  guesses_left = 8
  hangman_dash = len(secret_word) * "-"
  while guesses_left &gt; 0:
      print("The word now looks like this: " + (hangman_dash))
      print("You have " + str(guesses_left) + " guesses left")
      letter = input("Type a single letter, then press enter: ")
      letter = letter.upper()
      if len(letter) != 1:
          print("Please enter only one letter.")
      elif letter not in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYXZ':
          print("Please guess a letter.")
      if letter in secret_word:
          print("That guess is correct")
  
      else:
          print("There are no {}'s in the word".format(letter))
          guesses_left = guesses_left - 1
  </code></pre>