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

Python Python Basics (2015) Letter Game App Letter Game Introduction

Quinton Dobbs
Quinton Dobbs
5,149 Points

I found a problem with the code that has to do with repeated letters in a word.

This may be addressed in a later video, but I have "elephant" as one of my words and it doesn't register when you guess all of the letters, while the other words without repeated letters do. My guess is that because "e" is repeated twice in "elephant" the length of correct_guesses ends up being one short of the length of the secret_word so it doesn't register.

1 Answer

Steven Parker
Steven Parker
231,269 Points

You're right. That first logic for detecting a win only works for words with unique letters. A different strategy is needed to detect wins for any kind of word.

It's been a while, but I do think that this is discussed later, and if not fixed in the video it may be left up to you to construct a revised method.