Request Help Debugging Program

mzdude jsanga at cox.net
Thu Jul 24 03:14:09 CEST 2008


On Jul 23, 6:30 pm, Samir <spytho... at gmail.com> wrote:
> Hi Everyone,
>
>
> def findSumOfDivisor(n):
<snip>
>     return sum(divisor)                # fine using function sum()
>

>         sum = findSumOfDivisor(i)      # then find the sum of its divisors

oops redefine what sum is.

>>> x = [1,2]
>>> sum(x)
3
>>> sum = 4
>>> sum(x)

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



More information about the Python-list mailing list