[Tutor] Don't understand error messages.
alan.gauld at btinternet.com
Thu Apr 23 00:49:36 CEST 2009
"WM." <wferguson1 at socal.rr.com> wrote
> def DisplayBoard(HANGMAPIX, MissedLetters, CorrectLetters, SecretWord):
> for Letter in MissedLetters:
> Blanks = '_' * len(SecretWord)
> for i in range(len(SecretWord)):
> for Letters in Blanks:
> MissedLetters = ''
> while True:#151
> DisplayBoard(HANGMANPIX, MissedLetters, CorrectLetters,
First time through the program MissedLetters is empty so the for loop
never executes and Blanks is not initialised. The second for loop then
fails. You need to initialise Blanks at the head of the function.
Author of the Learn to Program web site
More information about the Tutor