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

Siddharth Pande
Siddharth Pande
9,044 Points

hey @kennethlove there is a bug in the code that you've written. what if a fruit name has a letter that is in two.....

a fruit name has a letter that is in two positions eg "apple" or "watermelon". Your code starts to behave awkwardly. Kindly let us know how to solve this issue.

1 Answer

Jennifer Nordell
STAFF
Jennifer Nordell
Treehouse Staff

Hi there! First, Kenneth is no longer with Treehouse and many of us miss him terribly. That being said, the first place you should look with any of the videos are the "Teacher's Notes". They aren't always just documentation links. Sometimes, they are easter eggs (surprises)!

Take a look at the Teacher's Notes for this one:

Did you notice? There's a tricky condition (on purpose) in the final version of our code from this video. Words that have repeated characters won't be marked as correct once they're all correctly guessed due to our len() comparisons. See if you can find a way to fix that yourself! We'll write a version without that bug in the next video.

Hope this helps! :sparkles:

Siddharth Pande
Siddharth Pande
9,044 Points

Hi Jennifer Nordell thanks for your quick response. I am glad to tell you that I found a way to bypass the bug by adding a for loop i.e. for letter in secret_word: if letter == guess: good_guess.append(guess)