nameList = []
scoreList = []
gradeList = []
run = 1
loop = 1
定义输入函数():
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)
我正在尝试使用除变量“studentScore”之外的尝试,但是它给了我错误“名称'studentScore'未定义”任何帮助表示赞赏
ITMISS
慕桂英3389331
相关分类