Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Morse Clock by UFO665
def digitToBin(digit, length):
return "{:0>{}}".format(bin(int(digit))[2:], length)
def checkio(time_string):
hour, minute, second = time_string.split(":")
hour, minute, second = "{:0>2}".format(hour), "{:0>2}".format(minute), "{:0>2}".format(second)
res = "{} {} : {} {} : {} {}".format(digitToBin(hour[0], 2), digitToBin(hour[1], 4),
digitToBin(minute[0], 3), digitToBin(minute[1], 4),
digitToBin(second[0], 3), digitToBin(second[1], 4))
return res.replace("1", "-").replace("0", ".")
Dec. 14, 2015