Skip to content

Latest commit

 

History

History
45 lines (26 loc) · 1.4 KB

README.md

File metadata and controls

45 lines (26 loc) · 1.4 KB

Morse Code Converter

A simple Python script that translates a string of text into Morse code. The script follows the standard Morse code alphabet, and currently, special characters like @, #, etc., are not supported.

Prerequisites:

  • Python 3.6 or higher installed on your system.

Running the application:

1- Clone this repository or download the project files.

2- Run the Python script to start the application.

  python Morse-Code.py

3- Using the script:

  • Input the string you want to convert from text to Morse code (without special characters).
  • Press Enter, and the script will output the equivalent Morse code.

Example

Type in the text you want to convert into morse code: hello world

Output:

**** * *-** *-** --- / *-- --- *-* *-** -**

Code Structure:

  • morse_alphabet dictionary: Stores the mapping from text to Morse code.
  • morse_converter function:
    • Converts a string to Morse code using list comprehension.
    • Handles characters not in the dictionary via error handling (KeyError).
    • Returns the final Morse code string.
  • User Input: The script prompts the user for input and displays the Morse code output.

License

This project is open-source and available under the MIT License.

Contact

If you have any questions, feel free to reach out to me at yagopais@id.uff.br.