title: Random word guessing game
body: <p>I want to create a word guessing game where the program randomly selects a word from my word list and the user has to guess the word.</p>
  
  <ul>
  <li>User can only guess one letter at a time.</li>
  <li>User is only allowed to have 6 failed guesses. (Loses when 6 failed attempts are used).</li>
  <li>User wins if he guess the complete word before 6 failed attempts is used.</li>
  </ul>
  
  <p>So I'm facing quite a number of problems with my program:</p>
  
  <ol>
  <li>How do I make the guessed letter stay on the blanks when it goes to the next round of guess?</li>
  <li>If the word has two of the same letters, how do I display it on my blanks too? </li>
  <li>How do I show all the user's missed letters for each round?</li>
  </ol>
  
  <p>Here's what I did so far:</p>
  
  <pre><code>import random
  
  wordlist = ['giraffe','dolphin',\
              'pineapple','durian',\
              'blue','purple', \
              'heart','rectangle']
  
  #Obtain random word
  randWord = random.choice(wordlist)
  
  #Determine length of random word and display number of blanks
  blanks = '_ ' * len(randWord)
  print ()
  print ("Word: ",blanks)
  
  
  #Set number of failed attempts
  count = 6
  
  #Obtain guess
  while True:
      print ()
      guess = input ("Please make a guess: ")   
      if len(guess) != 1:
          print ("Please guess one letter at a time!")
      elif guess not in 'abcdefghijklmnopqrstuvwxyz':
         print ("Please only guess letters!")
  
  #Check if guess is found in random word
      for letters in randWord:
          if guess == letters:
              letterIndex = randWord.index(guess)
              newBlanks = blanks[:letterIndex*2] + guess + blanks[letterIndex*2+1:]
              print ("Guess is correct!")
          else:
              count -=1
              print ("Guess is wrong! ", count, " more failed attempts allowed.")
      print() 
      print("Word: ",newBlanks) 
  </code></pre>
  
  <p>The results I hope to obtain (for randWord 'purple'):</p>
  
  <pre class="lang-none prettyprint-override"><code>Word: _ _ _ _ _ _ 
  Missed: 
  Please make a guess: l
  Guess is correct!
  
  
  Word: _ _ _ _ l _ 
  Missed:
  Please make a guess: z
  Guess is wrong! 5 more failed attempts allowed.
  
  
  Word: _ _ _ _ l _ 
  Missed: z
  Please make a guess: o
  Guess is wrong! 4 more failed attempts allowed.
  
  
  Word: _ _ _ _ l _ 
  Missed: z, o
  Please make a guess: p
  Guess is correct!
  
  
  Word: p _ _ p l _ 
  Missed: z, o
  Please make a guess: e
  Guess is correct!
  
  
  Word: p _ _ p l e 
  Missed: z, o
  Please make a guess: r
  Guess is correct!
  
  
  Word: p _ r p l e 
  Missed: z, o
  Please make a guess: u
  Guess is correct!
  
  
  Word: p u r p l e 
  YOU WON!
  </code></pre>