我是python的新手,我遇到了pycharm的问题。
如下图所示,我输入def main():
globalConstantList = [QUIZ_GRADES, PROGRAM_GRADES, TESTS]
scoreList = [0] * (QUIZ_GRADES + PROGRAM_GRADES + TESTS)
returnedScoresList = getGrades(globalConstantList, scoreList)
#totalList(totalScore[scores])
#userOutput()
print(returnedScoresList)
def getGrades(globalConstantList, scoreList):
for eachScore in globalConstantList:
#totalScoreList = 0.0
#index = 0 <-- not needed
for index in range(QUIZ_GRADES):
print("What is the score for quiz", index + 1)
scoreList[index] = float(input())
imin = QUIZ_GRADES
for index in range(imin, PROGRAM_GRADES + imin):
print("What is the score for program", index + 1)
scoreList[index] = float(input())
imin += PROGRAM_GRADES
for index in range(imin, TESTS + imin):
print("What is the score for test", index + 1)
scoreList[index] = float(input())
return scoreList
main()
而没有打印。但是运行结果仍然显示变量的值。这太令人困惑了。