Advertisement
Guest User

My python code

a guest
Sep 26th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. turns = 6
  2. word = "flavortown"
  3. guesses = []
  4. while turns > 0:
  5.   failed = 0
  6.   for char in word:
  7.       if char in guesses:
  8.         print char,
  9.       else:
  10.         print "_",
  11.         failed +=1
  12.   if failed == 0:
  13.     print "You win!"
  14.     break
  15.   print
  16.   guess = raw_input ("Guess a letter:")
  17.   guesses.append(guess)
  18.   if guess in word:
  19.     print "Right"
  20.   else:
  21.    print "Wrong"
  22.    turns -= 1
  23.    print "You have" , turns , "guesses left"
  24.   if turns == 0:
  25.    print "You lose"
  26.    print "The word was " + word
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement