can anyone help me out with this its a morse code progam and I want the user to input either t or m; t for text and m for morse code everytime I run it no matter if I input t it always says enter morse code to translate instead of enter text to translate, id appreciate any help!
while True:
print("")
Input = input("My input is: ")
message=input("Enter morse code to translate: ")
encodedMessage = ""
if Input.startswith ("m"):
for word in message.split(" "):
for char in word.split():
if char in morse:
encodedMessage+=morse[char] + " "
print("Your translation to text is: ",encodedMessage)
else:
print("Value for %r not found as morse."%char)
if Input.startswith ("t"):
print("Enter text to translate: ")
decodedMessage = ""
for word in hello.split():
if char in morseCode:
decodedMessage+=morseCode[char] + " "
print("Your translation to morse is: ",decodedMessage)
else:
print("Value for %r not found as a character."%char)
Input, capitali, is an available variable name. It's not very descriptive, but it doesn't mask anything.