Problem with the "for" loop syntax
Arturo B
a7xrturodev at gmail.com
Wed Jun 19 20:32:51 EDT 2013
Sorry, I'm new in here
So, if you want to see the complete code I've fixed it:
http://www.smipple.net/snippet/a7xrturo/Hangman%21%20%3A%29
And here is the part of code that doesn't work:
#The error is marked in the whitespace between letter and in
def displayBoard(HANGMANPICS, missedLetters, correctLetters, secretWord):
print (HANGMANPICS[len(missedLetters)])
print()
print('Missed letters: ', end='')
#Starts problem
for letter in missedLetters:
#Finishes problem
print(letter, end=' ')
print()
blanks = '_' * len(secretWord)
for i in range(len(secretWord)):
if secretWord[i] in correctLetters:
blanks = blanks[:i] + secretWord[i] + blanks[i+1:]
for letter in blanks:
print(letter, end=' ')
print()
When I press F5 (Run) I get a window that says: 'Invalid Syntax' and the whitespace between letter and in is in color red
More information about the Python-list
mailing list