为帖子简化了它(大多数“”是我程序中功能齐全的实际代码):
studentName = ""
def getExamPoints (total):
"calculates examPoints here"
def getHomeworkPoints (total):
"calculates hwPoints here"
def getProjectPoints (total):
"calculates projectPoints here"
def computeGrade ():
if studentScore>=90:
grade='A'
elif studentScore>=80:
grade='B'
elif studentScore>=70:
grade='C'
elif studentScore>=60:
grade='D'
else:
grade='F'
def main():
classAverage = 0.0 # All below is pre-given/ required code
classAvgGrade = "C"
studentScore = 0.0
classTotal = 0.0
studentCount = 0
gradeReport = "\n\nStudent\tScore\tGrade\n============================\n"
studentName = raw_input ("Enter the next student's name, 'quit' when done: ")
while studentName != "quit":
studentCount = studentCount + 1
examPoints = getExamPoints (studentName)
hwPoints = getHomeworkPoints (studentName)
projectPoints = getProjectPoints (studentName)
studentScore = examPoints + hwPoints + projectPoints #(<---- heres where my problem is!)
studentGrade = computeGrade (studentScore)
main()
它一直在说:
文件“/home/hilld5/DenicaHillPP4.py”,第 65 行,在 main studentScore =examPoints + hwPoints + projectPoints
类型错误:+ 不支持的操作数类型:“NoneType”和“NoneType”
我从未了解或听说过非类型错误,即使在谷歌搜索时也没有真正理解。任何认为他们了解正在发生的事情/知道什么是非类型的人?