[Tutor] python debug
Mats Wichmann
mats at wichmann.us
Mon Apr 26 09:15:40 EDT 2021
On 4/26/21 5:47 AM, Msd De wrote:
> Dear Sir,
> How to use nested def for two functions to integrate over a variable.
> The error displayed is
> TypeError: can't multiply sequence by non-int of type 'function
Perhaps share the code that's causing the error?
Usually the errors are pretty descriptive and this one suggests "you're
doing it wrong", but we can't see how.
>>> def f():
... pass
...
>>>
>>> s = [1, 2, 3]
>>> s * 3
[1, 2, 3, 1, 2, 3, 1, 2, 3]
>>> s * f
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: can't multiply sequence by non-int of type 'function'
Perhaps you left out the parentheses when calling your nested function?
More information about the Tutor
mailing list