Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
5-liner: used the built-in translate to MorseCode it solution in Creative category for Morse Clock by Stensen
converter = lambda b, f: b.translate(b.maketrans('01', '.-')).rjust(f, '.')
def checkio(ts):
str_time = ':'.join(map(lambda i: i.zfill(2), ts.split(':')))
return ' : '.join([f'{converter(bin(int(i))[2:], k)} {converter(bin(int(j))[2:], l)}' \
for (i, j), (k, l) in zip(str_time.split(':'), [(2, 4), (3, 4), (3, 4)])])
Oct. 23, 2020
Comments: