Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Add space to DIctionary solution in Clear category for Morse Decoder by vl.ev.ba
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",
"X":" "
}
def morse_decoder(code: str) -> str:
# your code here
a= "".join((MORSE[i] for i in code.replace(" ",' X ').split(' ')))
return a.capitalize()
print("Example:")
print(morse_decoder("... --- -- . - . -..- -"))
# These "asserts" are used for self-checking
assert morse_decoder("... --- -- . - . -..- -") == "Some text"
assert (
morse_decoder(".. .-- .- ... -... --- .-. -. .. -. .---- ----. ----. -----")
== "I was born in 1990"
)
print("The mission is done! Click 'Check Solution' to earn rewards!")
July 4, 2026
Comments: