I am building a secret word guesser in python and my error lies somewhere in my for loop. Any help would be greatly appreciated?

Viewed 25

My for loop continually counts the correct letters and adds them with the next guess which I only want it to count the correct letters in the guess.

count_1 =  0
for letter in phrase:
        if letter == ('B'):
            count_1 += 1
        if letter == ('R'):
            count_1 += 1
        if letter == ('I'):
            count_1 += 1
        if letter == ('N'):
            count_1 += 1
        if letter == ('G'):
            count_1 += 1
        if letter == ('C'):
            count_1 += 1
        if letter == ('O'):
            count_1 += 1
        if letter == ('F'):
            count_1 += 1
        if letter == ('F'):
            count_1 += 1
        if letter == ('E'):
            count_1 += 1
        if letter == ('E'):
            count_1 += 1
print(f'Correct Letters: {count_1}')
0 Answers
Related