This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 25th, 2013  |  syntax: None  |  size: 1.32 KB  |  views: 30  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. def guess_check(guess_pool,guess):
  2.     count=0
  3.     if guess not in guess_pool:
  4.         return "You've used that letter, Try another one!"
  5.         guess = raw_input("Please guess a letter again: ")
  6.  
  7.  
  8.  
  9. def hangman_start():
  10.     answer=choose_word(wordlist)
  11.     inter = create_inter(answer)
  12.     number_of_words=len(answer)
  13.     print "Welcome to the game, Hangman!"
  14.     print "I am thinking of a word that is %s letters long" % len(answer)
  15.     number_of_guesses = round(1.5*len(answer))
  16.     guess_pool = 'abcdefghijklmnopqrstuvwxyz'
  17.     while (number_of_guesses > 0):
  18.         count=0
  19.         print "You have %s guesses left" %number_of_guesses
  20.         print "Available letters: ", guess_pool
  21.         guess = raw_input("Please guess a letter: ")
  22.         for x in range(0,len(answer)):
  23.             if answer[x] == guess:
  24.                 inter = fill_guessed_word(answer,guess,inter,x)
  25.             else:
  26.                 count+=1
  27.         if count == number_of_words:
  28.             print "Oops! That letter is not in my word"
  29.             number_of_guesses-=1
  30.         else:
  31.             print "Good guess: ",inter
  32.         a= win_check(inter)
  33.         if a == True:
  34.             print "Congratulations!, you won!"
  35.             break
  36.         guess_pool=guess_pool_make(guess_pool,guess)
clone this paste RAW Paste Data