Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #48762
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-06-19 17:32 -0700 |
| References | <18f427ef-7a9a-413d-a824-65c9df430db3@googlegroups.com> |
| Message-ID | <681faf58-e913-41f5-b542-cb5c78983372@googlegroups.com> (permalink) |
| Subject | Re: Problem with the "for" loop syntax |
| From | Arturo B <a7xrturodev@gmail.com> |
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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Problem with the "for" loop syntax arturo balbuena <a7xrturodev@gmail.com> - 2013-06-19 14:14 -0700
Re: Problem with the "for" loop syntax John Gordon <gordon@panix.com> - 2013-06-19 21:30 +0000
Re: Problem with the "for" loop syntax Dave Angel <davea@davea.name> - 2013-06-19 17:32 -0400
Re: Problem with the "for" loop syntax Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-19 16:35 -0600
Re: Problem with the "for" loop syntax Arturo B <a7xrturodev@gmail.com> - 2013-06-19 15:53 -0700
Re: Problem with the "for" loop syntax Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-20 00:15 +0100
Re: Problem with the "for" loop syntax Arturo B <a7xrturodev@gmail.com> - 2013-06-19 17:32 -0700
Re: Problem with the "for" loop syntax Arturo B <a7xrturodev@gmail.com> - 2013-06-19 18:02 -0700
Re: Problem with the "for" loop syntax Chris Angelico <rosuav@gmail.com> - 2013-06-20 11:09 +1000
csiph-web