function that counts...

superpollo utente at esempio.net
Wed May 19 16:58:40 EDT 2010


Mark Dickinson ha scritto:
> On May 19, 9:30 pm, superpollo <ute... at esempio.net> wrote:
>> René 'Necoro' Neumann ha scritto:
>>> An idea would be:
>>>>>> def prttn(m, n):
>>> ...        return sum(1 for x in range(n) if sum(map(int, str(x))) == m)
>> TypeError: 'int' object is not callable
>>
>> on 2.5.4
> 
> The TypeError is almost certainly because you've created a integer
> 'sum' variable in your script/interpreter session, hiding the built-in
> sum function.

thx



More information about the Python-list mailing list