Page 49 - Programming the Raspberry Pi Getting Started with Python
P. 49
The function whole_word_guess is actually easier than the single_ letter_guess function:
All we have to do is compare the guess and the actual word to see if they are the same when they are
both converted to lowercase. If they are not the same, a life is lost. The function returns True if the
guess was correct; otherwise, it returns False.
That’s the complete program. Open up 4_8_hangman_full.py in the IDLE Editor and run it. The full
listing is shown here for convenience: