This is a simple Python-based Morse code encoder and decoder. The program allows users to input either a string of text or Morse code, and it will convert the input to the opposite format (from text to Morse code, or from Morse code to text).
- Encode: Convert plain text (letters, numbers, and space) into Morse code.
- Decode: Convert Morse code back into plain text.
- Supports: Lowercase and uppercase letters (both treated the same), numbers (0-9), and spaces.
-
Run the Program: Simply run the script, and you'll be prompted to either encode or decode a message.
-
Encoding:
- To encode a message, input any combination of letters, numbers, or spaces.
- The program will convert the message into Morse code, with each Morse code symbol separated by a space.
-
Decoding:
- To decode a Morse code message, input a string of Morse code symbols. Symbols should be separated by spaces.
- The program will convert the Morse code back into the original message.
-
Exit:
- To exit the program, type
#
when prompted.
- To exit the program, type
-
Ensure you have Python installed (version 3.x is recommended).
-
Copy the code from
morse_code.py
(or your script) into a Python file. -
Open a terminal or command prompt and navigate to the directory containing the Python script.
-
Run the program using:
python morse_code.py