Skip to content

Instantly share code, notes, and snippets.

@dvl
Created May 28, 2015 02:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvl/50cb6c1a886151dec04d to your computer and use it in GitHub Desktop.
Save dvl/50cb6c1a886151dec04d to your computer and use it in GitHub Desktop.
alphabet = {
".-": "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",
"/": " ",
}
phrase = '.... . .-.. .-.. --- / -.. .- .. .-.. -.-- / .--. .-. --- --. .-. .- -- -- . .-. / --. --- --- -.. / .-.. ..- -.-. -.- / --- -. / - .... . / -.-. .... .- .-.. .-.. . -. --. . ... / - --- -.. .- -.--'
print ''.join(alphabet.get(letter) for letter in phrase.split())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment