Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Morse Clock solution in Clear category for Morse Clock by JimmyCarlos
def checkio(input_str) -> str: # Yeah, this isn't morse code. This is a poor mission.
lengths = [[2,4],[3,4],[3,4]]
output_list = []
convert_to_pseudomorse=lambda s,n:bin(int(s))[2:].rjust(n,"0").replace("0",".").replace("1","-")
for timevalue,(length_a,length_b) in zip(input_str.split(":"),lengths):
timevalue = timevalue.rjust(2,"0")
output_list.append(convert_to_pseudomorse(timevalue[0],length_a) + " " +
convert_to_pseudomorse(timevalue[1],length_b))
return " : ".join(output_list)
July 21, 2019