Kent Johnson wrote:
On Wed, Apr 22, 2009 at 2:57 PM, WM. <wfergus...@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
The indents were dis-arrayed e-mail, due to a long REM;
in the script the indents are as you suggest.
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:
print Letter,
print
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor