Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
One line of morse solution in Clear category for Morse Decoder by new_hoschi
MORSE = {'.-': 'a', '-...': 'b', '-.-.': 'c',
'-..': 'd', '.': 'e', '..-.': 'f',
'--.': 'g', '....': 'h', '..': 'i',
'.---': 'j', '-.-': 'k', '.-..': 'l',
'--': 'm', '-.': 'n', '---': 'o',
'.--.': 'p', '--.-': 'q', '.-.': 'r',
'...': 's', '-': 't', '..-': 'u',
'...-': 'v', '.--': 'w', '-..-': 'x',
'-.--': 'y', '--..': 'z', '-----': '0',
'.----': '1', '..---': '2', '...--': '3',
'....-': '4', '.....': '5', '-....': '6',
'--...': '7', '---..': '8', '----.': '9'
}
'''1. Split the words from each other, 2. translate each word, 3. join the words
to a sentence, 4. capitalize the sentence'''
def morse_decoder(code):
return ' '.join([''.join(MORSE[k] for k in element.split()) for element in code.split(' ')]).capitalize()
April 29, 2020