nameList = []
scoreList = []
gradeList = []
run = 1
loop = 1
def inputFunction():
className = input("\nWhat is the class name: ")
topic = input("What is the topic: ")
while run == 1:
studentName = input("What is the students name? Enter 'done' to exit: ")
if studentName in ("done", "Done"):
break
try:
studentScore = int(input("What is the student's score? "))
except ValueError:
print("nonono")
if studentScore <50:
grade = "NA"
if studentScore >49 and studentScore <70:
grade = "A"
if studentScore > 69 and studentScore < 90:
grade = "M"
if studentScore > 89:
grade = "E"
nameList.append(studentName)
scoreList.append(studentScore)
gradeList.append(grade)
print("\nClass Name:",className)
print("Class Topic:",topic)
I am trying to use a try and except for the variable "studentScore" however it gives me the error "name 'studentScore' is not defined" any help appreciated