0
Help with my program
Im trying to make a "translator" in python for morse code, Ive defined the characters, but it only works when the input is an individual character(a). Any help?
4 Answers
+ 7
Without code, we can't help you create anything. You're trying to ask for us to do it all, before you have even put a small effort into doing it yourself.
+ 6
Pls post your code or make it public for anyone to view.
+ 6
This should work seamlessly for letter-only strings (words). Try adding an empty space, interpunction signs and digits for better usability.
0
The only thing im asking for is possible issues, already cleared up what ive done. sorry for the late reply though, was pretty busy. my code:
. .:
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': '--..',
}
msg = input('Enter your message')
for char in msg:
print (CODE[char.upper()])