Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
A bit of format, replace, zip, split and join solution in Clear category for Morse Clock by obone
def checkio(time_string: str) -> str:
fixtime = lambda t: ''.join(['{0:02d}'.format(int(c)) for c in t.split(':')])
tomorse = lambda n, l: ('{0:0'+l+'b}').format(int(n)).replace('0', '.').replace('1', '-')
morseti = lambda t: '{} {} : {} {} : {} {}'.format(*[tomorse(*d) for d in zip(fixtime(t), "243434")])
return morseti(time_string)
July 8, 2019
Comments: