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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Haitham al-mandhary](https://secure.gravatar.com/avatar/e7b52a5b01e28a24d1a1720a17be0501?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Haitham al-mandhary
Courses Plus Student 1,488 PointsKindly could you explain this part**while len(bad_guesses) < 7 and len(good_guesses) != len(secret_letter):**please.
Dear Kenneth, hope you are fine,
please i need some help that i didnt get the idea yet why we use len(good_guesses) != len(secret_letter in the vedio you said that letter in both list are same so why we use
*** != *** between them ??
Many thanks.
2 Answers
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsThere's two things being tested there at the same time. The first is "len(bad_guesses) < 7
" which is checking that the number of misses is less than 7 (otherwise the player loses). The other test is "len(good_guesses) != len(secret_letter)
" and "!=
" is the inequality comparison (it means "is not equal to"). So this test is checking that the number of good guesses is not the same as the number of letters in "secret_letter" (otherwise the player has won). Either way, it would mean the game is over which is what the entire expression is testing.
Note that comparing good guesses with the word size only works if every letter in the word is different. You would need different logic to correctly determine a win of the word had multiples of any letter (like "color").
![Andrew Choai](https://secure.gravatar.com/avatar/162e988988a20a18f5d08a3b565db7c4?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Andrew Choai
695 PointsI can't seem to wrap my head around this concept. Wouldn't you want to make good_guesses = secret_word to show that they player won?
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsWell, one is a list and the other is a string, so at most you would only compare their lengths. But as I said, that won't always show a win. For example, the word "beep" has 4 letters, but only takes 3 guesses to win.