Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gLets = []
- guessO = int(8)
- guessRem = guessO
- print 'Welcome to the game, Hangman!'
- print 'I am thinking of a word that is ' + str(len(secretWord)) + ' letters long.'
- while guessRem > 0:
- if isWordGuessed(secretWord, gLets):
- break
- print '-------------'
- print 'You have ' + str(guessRem) + ' guesses left.'
- print 'Available letters: ' + str(getAvailableLetters(gLets))
- thisGuess = (str(raw_input('Please guess a letter: '))).lower()
- if thisGuess in gLets:
- print "Oops! You've already guessed that letter: "+ str(getGuessedWord(secretWord, gLets[:]))
- elif thisGuess in secretWord:
- gLets.append(thisGuess)
- print 'Good guess: ' + str(getGuessedWord(secretWord, gLets[:]))
- else:
- print "Oops! That letter is not in my word: "+ str(getGuessedWord(secretWord, gLets[:]))
- gLets.append(thisGuess)
- guessRem -= 1
- if isWordGuessed(secretWord, gLets):
- print '-------------'
- print 'Congratulations, you won!'
- else:
- print '-------------'
- print 'Sorry, you ran out of guesses. the word was '+ secretWord
Advertisement
Add Comment
Please, Sign In to add comment