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" : "--.. ",
}
def morse(word):
for i in word:
if i == " ":
print(" " * 2, end="")
else:
print(code[i], end="")
word = input("Type A Sentence: ")
word = list(word.upper())
print(morse(word))
how do I remove the "none" after this is ran? because running this prints out none at the end.
everything seems to be working fine except for that none at the end
Type A Word: hello .... . .-.. .-.. --- None