0

I am attempting to write a simple Letter Grade Converter that takes an input from 0-100 and returns a letter grade. The End of the while statement asks for a y/n input to continue the conversion or end it. Entering Y seems to always return a name error that y has not been defined.

print("Letter Grade Converter")

choice = "y"
while choice.lower() == "y":
    number = int(input("Enter numerical grade: "))
    if number > 87:
        letter = "A"
    elif number > 79:
        letter = "B"
    elif number > 66:
        letter = "C"
    elif number > 59:
        letter = "D"
    else:
        letter = "F"

    print("Letter Grade: " + letter)
    choice = input("Continue (y/n)?: ")
print ("Bye!")

I have already defined choice in the beginning, is that what is causing a name error??

0 Answers0