def add(x,y,f):报错
>>> def add(x,y,f):
... return f(x)+f(y)
...
>>> add(-5,9,abs)
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "<input>", line 2, in add
TypeError: object of type 'int' has no len()
按照老师的例子测试报错,这是什么问题呢?
>>> def add(x,y,f):
... return f(x)+f(y)
...
>>> add(-5,9,abs)
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "<input>", line 2, in add
TypeError: object of type 'int' has no len()
按照老师的例子测试报错,这是什么问题呢?
2015-04-16
举报