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)

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.