Skip to content

This project is a Python program that converts text into Morse code. It uses a dictionary to match letters, numbers, and some punctuation to their Morse code symbols. If the user enters any invalid characters, the program will ask for a valid input. Spaces between words are represented by /.

Notifications You must be signed in to change notification settings

yagop27/Morse-Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

This project is a Python program that converts text into Morse code. It uses a dictionary to match letters, numbers, and some punctuation to their Morse code symbols. If the user enters any invalid characters, the program will ask for a valid input. Spaces between words are represented by /.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages