[Tutor] Don't understand error messages.

Kent Johnson kent37 at tds.net
Wed Apr 22 21:21:24 CEST 2009


On Wed, Apr 22, 2009 at 2:57 PM, WM. <wferguson1 at socal.rr.com> wrote:
> Using Windows XP, Python 2.6 & Al Sweigart's "Invent Your Own...", I keyed
> in the Hangman Program. So far as I can tell it is totally proofed out.
>  Still, I get an error message which makes no sense to me.

> def DisplayBoard(HANGMAPIX, MissedLetters, CorrectLetters, SecretWord):
>   print HANGMANPIX[len(MissedLetters)]
>   print
>
>   print 'MissedLetters:',
>   for Letter in MissedLetters:
>       print Letter,
>       print
>
>       Blanks = '_' * len(SecretWord)
>
>       for i in range(len(SecretWord)):
>           # 116 Replace Blanks with correctly guessed letters.
>           if SecrettWord[i] in CorrectLetters:
>               Blanks = Blanks[:i] + SecretWord[i] + Blanks[i+1:]
>                 for Letters in Blanks:#Show SecretWord w 1 space between
> letters.
>       print Letter,

The above line should be indented more than the previous line. I'm not
sure if that is the cause of your error but give it a try and see.

Kent


More information about the Tutor mailing list