Easy function, please help.

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Feb 10 02:08:29 EST 2011


On Wed, 09 Feb 2011 22:53:27 -0800, drygal wrote:

> I guess it needs:
> 
> def num_digits(n):
>    return len(str(n)) -1


I don't think so.

>>> num_digits(9)
0



-- 
Steven



More information about the Python-list mailing list