好的,所以我正在用 python 编写一个成绩检查代码,我的代码是:
unit3Done = str(input("Have you done your Unit 3 Controlled Assessment? (Type y or n): ")).lower()
if unit3Done == "y":
pass
elif unit3Done == "n":
print "Sorry. You must have done at least one unit to calculate what you need for an A*"
else:
print "Sorry. That's not a valid answer."
当我通过我的 python 编译器运行它并选择"n"
时,我收到一条错误消息:
“NameError:名称'n'未定义”
当我选择"y"
另一个NameError
问题'y'
时,但当我做其他事情时,代码会正常运行。
任何帮助是极大的赞赏,
谢谢你。