fork download
  1. def right_zeros(n):
  2. z = 0
  3. while True:
  4. n, r = divmod(n, 10)
  5. if n == 0 or r != 0:
  6. return z
  7. z += 1
  8.  
  9. print(right_zeros(123000))
  10. print(right_zeros(102030))
  11. print(right_zeros(123123))
  12. print(right_zeros(10))
  13. print(right_zeros(0))
  14. print(right_zeros(1))
Success #stdin #stdout 0.02s 9936KB
stdin
Standard input is empty
stdout
3
1
0
1
0
0