Skip to content

Instantly share code, notes, and snippets.

@clarerocks2007
Last active October 29, 2019 19:29
Show Gist options
  • Save clarerocks2007/5a36c43a1c1d0fbf813780f5d6100a06 to your computer and use it in GitHub Desktop.
Save clarerocks2007/5a36c43a1c1d0fbf813780f5d6100a06 to your computer and use it in GitHub Desktop.
How to Type Morse Code In Python
code= {'A': '.-', 'B': '-...', 'C': '-.-.',
'D': '-..', 'E': '.', 'F': '..-.',
'G': '--.', 'H': '....', 'I': '..',
'J': '.---', 'K': '-.-', 'L': '.-..',
'M': '--', 'N': '-.', 'O': '---',
'P': '.--.', 'Q': '--.-', 'R': '.-.',
'S': '...', 'T': '-', 'U': '..-',
'V': '...-', 'W': '.--', 'X': '-..-',
'Y': '-.--', 'Z': '--..',
'0': '-----', '1': '.----',
'2': '..---',
'3': '...--', '4': '....-', '5': '.....',
'6': '-....', '7': '--...', '8': '---..',
'9': '----.', ' ':'new word ' }
morseCode=input("Type something in all caps, and I'll convert it to Morse code(I welcome numbers as well):" )
for character in morseCode:
print(code[character])
@clarerocks2007
Copy link
Author

MORSE CODE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment