Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Morse Clock by tokiojapan55
def checkio(time_string: str) -> str:
morse = lambda n,b: ''.join(['.' if c=='0' else '-' for c in ('0'*b+bin(n)[2:])[-b:]])+' '
token = [int(n) for n in time_string.split(':')]
return (morse(token[0]//10, 2) + morse(token[0]%10, 4) + ": " + \
morse(token[1]//10, 3) + morse(token[1]%10, 4) + ": " + \
morse(token[2]//10, 3) + morse(token[2]%10, 4)).strip()
June 17, 2020
Comments: