Morse Code (Python)

Python Morse Code Translator

11th January is #LearnYourNameInMorseCodeDay.

GCHQ Morse Code
GCHQ Morse Code

I found this out as GCHQ tweeted the following today:

geektechstuff_morse_code_py_0
GCHQ Morse Code Tweet

Which is Morse Code. I’ve never learned Morse Code, but wanted to know what GCHQ were tweeting about. I few solutions came to mind:

  1. Convert the morse manually
  2. Use an online tool to convert the Morse
  3. Build a Python tool to convert the Morse

As I have recently been getting to grips with ciphers in Python, and as I wanted a little challenge I went with option 3 and got Python to convert the Morse for me.

geektechstuff_morse_code_py_1
Python Morse Code Translator

I found it easier to translate English to Morse as I hit a small snag with looking up a dictionary key by its value. Thankfully StackOverFlow had the answer.

The complete Python code is available on my GitHub here: https://github.com/geektechdude/Python_Encryption/blob/master/geektechstuff_morse_code.py

geektechstuff_morse_code_py_2
.-.. . .- .-. -. / -.– — ..- .-. / -. .- — . / .. -. / — — .-. … . / -.-. — -.. .

If you like puzzles / challenges then I recommend following the GCHQ Twitter feed. There are also two GCHQ puzzle books, and they have a GitHub (https://github.com/gchq).

One thought on “Morse Code (Python)

Comments are closed.