Request Help Debugging Program

Niklas Norrthon niklas.norrthon at hotmail.com
Thu Jul 24 00:44:02 CEST 2008


On 24 Juli, 00:30, Samir <spytho... at gmail.com> wrote:
> from math import sqrt
>
> def findSumOfDivisor(n):
[...]
>     return sum(divisor)                # return the sum of the
> divisors

> for i in range(2,10):                  # loop through integers 2
> through 9
[...]
>         sum = findSumOfDivisor(i)      # then find the sum of its divisors
[...]
> Traceback (most recent call last):
>   File "pe_prob021.py", line 19, in <module>
>     sum = findSumOfDivisor(i)      # then find the sum of its divisors
>   File "pe_prob021.py", line 12, in findSumOfDivisor
>     return sum(divisor)                # return the sum of the
> divisors
> TypeError: 'int' object is not callable
>

'int' object is not callable... hmmm...

>>> 42()

Traceback (most recent call last):
  File "<pyshell#21>", line 1, in <module>
    42()
TypeError: 'int' object is not callable

>>> divisor = 1
>>> sum = 42
>>> sum(divisor)

Traceback (most recent call last):
  File "<pyshell#26>", line 1, in <module>
    sum(divisor)
TypeError: 'int' object is not callable

That must be it.
No debugging, just reading the error message and the code...





More information about the Python-list mailing list