function that counts...
Mark Dickinson
dickinsm at gmail.com
Wed May 19 16:48:46 EDT 2010
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.
--
Mark
More information about the Python-list
mailing list