对于一个学校项目,我被要求让老师以几种方式查看一些分数,但每当我运行该程序时,我都会收到此错误:
CREATE PROCEDURE `updateLevel` ()
BEGIN
UPDATE badges set level=2 WHERE precentage > 50;
END
这是我的代码 - 我有一个菜单系统,询问你如何对它进行排序,现在我没有做菜单的类部分。任何帮助将不胜感激。问我是否需要解释。
(如果你需要知道我的CSV文件的每一行都有什么 - 名字,姓氏,得分1,得分2,得分3,等级(A,B或C. [现在暂时忽略这一点])
Traceback (most recent call last):
File "\\shs-sr-fap-01\11-62$\School\Computing\A453\Task 3\Teacher Score Viewer.py", line 53, in <module>
byalphabet()
File "\\shs-sr-fap-01\11-62$\School\Computing\A453\Task 3\Teacher Score Viewer.py", line 36, in byalphabet
for row in sorted(byalphabet, key=lambda x:x(int(x[2]), int(x[3]), int(x[4])), reverse = True):
File "\\shs-sr-fap-01\11-62$\School\Computing\A453\Task 3\Teacher Score Viewer.py", line 36, in <lambda>
for row in sorted(byalphabet, key=lambda x:x(int(x[2]), int(x[3]), int(x[4])), reverse = True):
TypeError: 'list' object is not callable
答案 0 :(得分:0)
您收到错误:
TypeError: 'list' object is not callable
从这一行:
for row in sorted(byalphabet, key=lambda x:x(int(x[2]), int(x[3]), int(x[4])), reverse = True):
这是因为byalphabet
的元素不是函数,但您尝试使用x(...)
调用它们。我猜你的意思是要有一个元组:
for row in sorted(byalphabet, key=lambda x:(int(x[2]), int(x[3]), int(x[4])), reverse = True):
此外,对函数和列表使用相同的名称是不好的:
def byalphabet():
...
byalphabet = []