• easy solution

Question related to mission Morse Decoder

 
def morse_decoder(code):
    # replace this for solution
    decode = ""
    list_of_symbols = code.split(" ")

    for symbol in list_of_symbols:
        if symbol != "":
            decode += MORSE[symbol]
        else:
            decode += " "

    result = decode.replace("  ", " ").capitalize()
    return result


if __name__ == '__main__':
    print("Example:")

    print(morse_decoder('... --- ...'))

    # These "asserts" using only for self-checking and not necessary for auto-testing
    assert morse_decoder("... --- -- .   - . -..- -") == "Some text"
    assert morse_decoder("..--- ----- .---- ---..") == "2018"
    assert morse_decoder(".. -   .-- .- ...   .-   --. --- --- -..   -.. .- -.--") == "It was a good day"