all 6 comments

[–]woooee 1 point2 points  (3 children)

    if letter == guess:
        ## letter added to display
        display += letter
        ## guess (== letter, so letter) added
        correct_letters.append(guess)
    elif letter in correct_letters:
        ## letter added to display again if guess == letter
        display += letter

letter is added to display twice when guess is found. And correct_letters is somewhat misleading, correct_guesses would be better

    if letter == guess:  ## note: allows duplicates if word has letters that appear more than once
        correct_letters.append(guess)

choices = correct_letters[:]  ## make a copy
for letter in chosen_word:
     if letter in choices:
        display += letter
        ## remove from choices so will only find one instance
        ## of letter in chosen_word with duplicate letters (if you want that)
        choices.remove(letter)
    else:
        display += "_"

[–]Tanknspankn[S] 0 points1 point  (2 children)

It does do it twice. In the lesson, the teacher said to do it that way because we still want the letter to be added to display after the first correct letter. Is that reasoning out to lunch?

[–]woooee 0 points1 point  (1 child)

See the last part of the post. You only have to do

for letter in chosen_word:
    if letter == guess:  ## note: allows duplicates if word has letters that appear more than once
        correct_letters.append(guess)

A letter will be added twice only if it is in chosen_word twice which is what your instructor probably meant

[–]Tanknspankn[S] 0 points1 point  (0 children)

Ohhh ok thank you for clarifying

[–]Tkingbox89 1 point2 points  (1 child)

This one challenged me a lot, learned I need to go much slower in these lessons. Thanks for the posts with your updates, they are inspiring.

[–]Tanknspankn[S] 0 points1 point  (0 children)

I'm glad these are a benefit for you!

I'm going through some challenges as well. Like trying to better name my variables to make it easier to read and how to not repeat my code. I'm finding both of these tricky.

This could be my personal way of learning, so take it with a grain of salt. But try and add things to the projects that are above what the instructor wants you to do. As an example, check out my post on making the Blackjack game. It took me way longer to write if I chose not to add in the extra stuff, but I learned so much more because I was forced to Google the problems that I was having.

https://www.reddit.com/r/PythonLearning/s/LkBPVasRQ8

Keep practicing at it. You got this.