I'm making a program where the Morse Code is decrypted into English.
However, when the program is running and I put the Morse Code in (ex. *-
which should result in the program printing out A
) the program only gives a blank space.
message = input("Please type a message to encrypt. ")
new_message = ""
letters = {"*-": "A",
"-***": "B",
"-*-*": "C"}
for let in message:
if let in letters:
new_message += letters[let]
print(new_message)
I'm looking for a way to solve this problem by using the replacing method above.