Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
native_beginning_zeros solution in Clear category for Beginning Zeros by Jon_Red
def beginning_zeros(number:str)->int:
return len(number)-len(number.lstrip('0'))
if __name__=='__main__':
# self-checks
assert beginning_zeros('100')==0
assert beginning_zeros('001')==2
assert beginning_zeros('100100')==0
assert beginning_zeros('001001')==2
assert beginning_zeros('012345679')==1
assert beginning_zeros('0000')==4
July 10, 2020
Comments: