Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Morse Clock by MMM_AAA_NNN
def checkio(time_string):
time = time_string.split(":")
morseclock = ""
for n in range(3):
time[n] = time[n].zfill(2)
if n == 0:
morseclock += morse(time[n][0], 2)
else:
morseclock += " : " + morse(time[n][0], 3)
morseclock += " " + morse(time[n][1], 4)
return morseclock
def morse(char, zf):
return bin(int(char))[2:].zfill(zf).replace("1","-").replace("0",".")
April 2, 2015