所以我当时正在做一个学校项目,但是我似乎无法弄清为什么它说“ resultsByClassNameDic”的名称未定义
class Results ():
## Class that contains all kinds of things for handling grades (all classnames are in the dic below)
# Variables
resultsByClassNameDic = {"backend" : 0, "frontend" : 0, "database" : 0, "office" : 0, "english" : 0, "dutch" : 0, "calculus" : 0, "SLB" : 0, "L&B" : 0}
# Functions
def getGrade(className):
## Will return the grade for a certain class
global resultsByClassNameDic
grade = resultsByClassNameDic.get(className)
return grade
def main ():
## Main Program
a = Results.getGrade("backend")
print(a)
return 0
### Main Program ###
if (__name__ == "__main__"):
if (debugMode):
doctest.testmod()
main()