Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. word = ['a', 'w', 'a', 'k', 'e']
  2. word_blank = ['-', '-', '-', '-', '-']
  3. num_attempts = 10
  4.  
  5. player_guess = input(("Guess a letter. You have %s chances left. ") % num_attempts)
  6. print(word_blank)
  7.  
  8. while num_attempts != 0:
  9.     for word in word_blank:
  10.         if player_guess == word[0]:
  11.             word_blank[word.index(word)] = player_guess
  12.             print ("That is correct")
  13.         else:
  14.             num_attempts -= 1
  15.             print(("Incorrect, you have %d attempts left") % num_attempts)
  16.             player_guess = input(("Guess a letter. You have %s chances left. ") % num_attempts)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement