variables not defined in if statements for change counting program
<p>I'm making a change counter and I'm having trouble printing the percentage for a grade, whenever I run the program I can enter as many inputs as I want, however, when I type done, which is supposed to terminate the program and leave the user with the percentage and letter grade, it just ends the program. If I could get any advice it would be greatly appreciated.
here's my code:</p>

<pre><code>grade=""
total=0
count=1
scores=''

while scores != 'done':
    scores=input("Enter Homework score: ")
    if scores.isdigit():
        numeric=int(scores)
        percentage=(numeric*10/count)
    elif percentage &gt;= 92 and percentage &lt; 100:
        letter = 'A'
    elif percentage &gt;= 87 and percentage &lt; 92:
        letter = 'B+'
    elif percentage &gt;= 80 and percentage &lt; 87:
        letter = 'B'
    elif percentage &gt;=77 and percentage &lt; 80:
        letter = 'C+'
    elif percentage &gt;=70 and percentage &lt; 77:
        letter = 'C'
    elif percentage &gt;= 67 and percentage &lt; 70:
        letter = 'D+'
    elif percentage &gt;= 60 and percentage &lt; 67:
        letter = 'D'
    elif percentage &lt; 60 and percentage &gt;= 0:
        letter= 'F'
    elif (numeric) &lt; 0:
        print("Score must be between 0 and 10")
    elif (numeric) &gt; 10:
        print("Score must be between 0 and 10")
    elif (scores)== 'done':
         print(percentage,"% and you got an, ",letter)
</code></pre>

<p>Your code should look similar to the one below. Although I still cannot assess the logic behind your program (because you did not explain that in your question, e.g. <code>percentage=(numeric*10/count)</code> does not seem quite right to me, etc.), but the code below solves your current problem (based on your current question). </p>

<pre><code>grade=""
total=0
count=1
scores=''

percentage = 0

while scores != 'done':
    scores=input("Enter Homework score: ")

    if scores.isdigit():
        numeric=int(scores)

        if numeric &lt; 0:
            print("Score must be between 0 and 10")
        elif numeric &gt; 10:
            print("Score must be between 0 and 10")

        percentage=(numeric*10/count)



if percentage &gt;= 92 and percentage &lt; 100: # I would change this to if percentage &gt;= 92 and percentage &lt;= 100:
    letter = 'A'
elif percentage &gt;= 87 and percentage &lt; 92:
    letter = 'B+'
elif percentage &gt;= 80 and percentage &lt; 87:
    letter = 'B'
elif percentage &gt;=77 and percentage &lt; 80:
    letter = 'C+'
elif percentage &gt;=70 and percentage &lt; 77:
    letter = 'C'
elif percentage &gt;= 67 and percentage &lt; 70:
    letter = 'D+'
elif percentage &gt;= 60 and percentage &lt; 67:
    letter = 'D'
elif percentage &lt; 60 and percentage &gt;= 0:  #I would change this to else:
    letter= 'F'

print(percentage,"% and you got an, ",letter)
</code></pre>

python