Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
alexandracoder0809
2,606 Pointsletter_game: Acting weird, doesn't count and says always I have guessed that. Searching for an indentation error maybe
Hi,
I have a problem with the letter_game1 because I start it and it says alwas: "You've guessed that letter." and doesn't count the strikes. So, I think it's an itendation error which I don't find. Here is my code:
http://pastie.org/private/h5dt5woy1dmuhmmrkfiuoq
I hope it's ok to share it like that, the other methods didn't work:)
Thanks in Advance for your help!
2 Answers
Steven Parker
243,215 Points
It looks like you have a stray "not" in a test:
elif not guess in bad_guesses or guess in good_guesses:
With the "not" there, you get the "already guessed" message for anything not yet guessed.
Also, when checking for a win, you compare the number of good guesses against the length of the word. While this will work fine for words with unique letters (like "lime"), a win will never be recognized on a word that has multiples of any letter (like "apple"). So you might want to develop a different testing strategy.
alexandracoder0809
2,606 PointsThanks a lot!! That was it!