Skip to content
Sign upLog in
← Back to Community

Text to Morse code converter

Profile icon
ZestyLad

Just wanna share my simple text to morse code converter. For some reason, z wouldn't work so I just added an if and else condition for it since it's just the single letter that don't work.

Voters
Profile icon
rickjames
Profile icon
CodingGoose
Profile icon
ELOUANblanc
Profile icon
thenullified
Profile icon
Highwayman
Profile icon
Trollertowner
Profile icon
ad101lab
Profile icon
xolyon
Profile icon
ZestyLad
Comments
hotnewtop
Profile icon
Highwayman

Awesome! Also sick name XD

Profile icon
ZestyLad

Haha, thank you!

Profile icon
Highwayman
Profile icon
CodingGoose

--. --- --- ... .
G O O S E

Profile icon
thenullified

this program is actually quite good. but i have some feedback for you:

  1. the function will not work if i enter capital letters
  2. maybe you can add a option at the back so that the user can use the translator again? you can do by squeezing your code into a function and call the function back again.
    eg: def morse_code():
    .
    .
    .
    again = input('do you want to use the converter again? y/n')
    while again == y:
    return morse_code()
    else:
    exit()
Profile icon
thenullified

for your next advancement you can use stuff like import string (string = abcd...xyz so you wont have to define alphabet), dictionaries for morseAlpha and alphabet(make a dictionary for both lowercase and upper by using acsii maybe solves the capital letter problem?)

Profile icon
ZestyLad

@starblazer
Thanks for the feedback, didn't know about that caps letter, already updated it, just didn't add a function though cause it wasn't that necessary when u can just use while loop right?

Profile icon
thenullified

@ZestyLad
nice work

Profile icon
[deleted]

This is really cool, but I would suggest adding numbers and other symbols(correct me if I'm wrong, I don't know too much about Morse)

Profile icon
ZestyLad

@hendryxu
Thank you, I will look into it.