Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Morse Clock by vikulin
def checkio(time):
r, t = [], list(''.join(map(lambda s: s if len(s)==2 else '0'+s, time.split(':'))))
for bits in (2,4,3,4,3,4):
m, n = '', int(t.pop(0))
for b in range(bits):
m, n = ('-' if n&1 else '.') + m, n >> 1
if bits == 3:
r.append(':')
r.append(m)
return ' '.join(r)
Sept. 30, 2014
Comments: