Re: Request Help Debugging Program

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Niklas Norrthon

    Re: Request Help Debugging Program

    On 24 Juli, 00:30, Samir <spytho...@gmai l.comwrote:
    from math import sqrt
    >
    def findSumOfDiviso r(n):
    [...]
        return sum(divisor)                # return the sum of the
    divisors
    for i in range(2,10):                  # loop through integers 2
    through 9
    [...]
            sum = findSumOfDiviso r(i)      # then find the sum of its divisors
    [...]
    Traceback (most recent call last):
      File "pe_prob021.py" , line 19, in <module>
        sum = findSumOfDiviso r(i)      # then find the sum of itsdivisors
      File "pe_prob021.py" , line 12, in findSumOfDiviso r
        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#2 1>", line 1, in <module>
    42()
    TypeError: 'int' object is not callable
    >>divisor = 1
    >>sum = 42
    >>sum(divisor )
    Traceback (most recent call last):
    File "<pyshell#2 6>", 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...


Working...