[Solved] NameError: name ‘grade’ is not defined [closed]


It looks like your if statements are checking for the variable grade, but your input is being assigned to letterGrade. You can fix this either by changing your first line to

grade = input("Please enter a letter grade: ")

or change every instance of grade to letterGrade.

Additionally, grade == "4.0" should probably be grade = "4.0"; x == y checks if x is equal to y, whereas x = y sets x equal to y.

1

solved NameError: name ‘grade’ is not defined [closed]