def nod(n):
        c,i=0,0
        while n>0:
                c=n%10
                if c!=0:
                        i=i+1
                n=n//10
        print(i)#prints the number of digits in the given integer 'n'

how to make it able to count 'zeros'?

OFF-TOPIC

nod = lambda(x): len(str(x))

print nod(125125)

Cheers and Happy coding

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.