Count how many zeros are at the end of your int:
def end_zeros(num):
s = str(num)
return len(s) - len(s.rstrip("0"))
print(end_zeros(10)) # == 1
print(end_zeros(101)) # == 0
print(end_zeros(245)) # == 0
print(end_zeros(100100)) # == 2
---------------- Writing a loop (using % and // ) feels like [reinventing
the wheel] and seems intrinsically wrong.
i like this code (above) because it's not reinventing the
wheel --- the Python implementor has already done the loop (using % and //
), so i'm just using that efficient tool (routine).
--
https://mail.python.org/mailman/listinfo/python-list