how to make a morse code translator in python

Solutions on MaxInterview for how to make a morse code translator in python by the best coders in the world

showing results for - "how to make a morse code translator in python"
Sam
21 Jun 2019
1import time
2
3eng_to_morse = {
4    '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' : '--..', '.' : '.-.-.-', '?' : '..--..', ',' : '--..--', ' ' : '/'
5}
6outstr = ''
7space = ' '
8senc = 0
9wordprocces = 0
10word = input('Enter a sentance : ')
11lenword = len(word)
12
13for i in word:
14    if i not in morse_to_eng:
15        print('Data not formatted properly')
16        time.sleep(5)
17        break
18    else:
19        print(eng_to_morse[i], end=' ')
Fabian
22 May 2017
1import time
2morse_to_eng = {
3    '....' : 'h', '.-' : 'a', '-...' : 'b', '-.-.' : 'c', '-..' : 'd', '.' : 'e', '..-.' : 'f', '--.' : 'g', '..' : 'i', '.---' : 'j', '-.-' : 'k', '.-..' : 'l', '--' : 'm', '-.' : 'n', '---' : 'o', '.--.' : 'p', '--.-' : 'q', '.-.' : 'r', '...' : 's', '-' : 't', '..-' : 'u', '...-' : 'v', '.--' : 'w', '-..-' : 'x', '-.--' : 'y', '--..' : 'z', '.-.-.-' : '.', '..--..' : '?', '--..--' : ',', '/' : ' '
4}
5
6word = input('Enter a sentance : ')
7lenword = len(word)
8words = ''
9for i in word:
10    if i != ' ':
11        words=words+i
12        if i not in morse_to_eng:
13            print('Data not formatted properly')
14            time.sleep(5)
15            break
16    elif i == '/':
17        print(morse_to_eng[words], end=' ')
18    else:
19        print(morse_to_eng[words], end='')
20        words = ''
queries leading to this page
morse code numbers and letters python dictionarymorse code translator python apimorse code for number python codeenglish to morse code pythonmorse code writer pythondecrypt morse code pythonpython convert binary to morse codeconvert to morse code pythonhow to make a morse translator pythonmorse code to binary pythonpython list morse codemorse code dictionary pythontranslator to code morse pythobconvert morse code pythonmorse code python programpython morse 27codemors code dictionary pythontext into morse code pythonmorse code binary pythonconvert char to morse code pythonmorse code generator micro pythonmorse code to english pythonpython morse code translatormorse code to alphabet dictionary pythonpython code translatormorse code python that takes a listmorse code pythonpython converter morse codemorse code to text converter pythonpython library to convert english morse codemorse code decoder pythonhow to make a morse program in python image morse code in pythonmorse code translator pythondef decode morse 28morse 29 3aascii to morse pythonconvert text to morse code pythonpython morse code dictionarypython morse code to englishpython to morse codestring to morse code pythonpython program text to morse codepython english to morse codemorse pythoncreate a function that takes a string as an argument and returns the morse code equivalent morse to text pythoncode to convert morse code to text pythonmorse code python dictionarympython morse codemorse code to pythonmorse code translator python moduletranslate binary to morse code pythonpython morse code built inall possible morse code decoding pythonfrom morse dict import morse 2 ascii def decode morse 28morse 29 3amorse code converter pythonmorse code translator in pythonconvert string of numbers to morse code pythonconverting string to morse code dictionarytext to morse and vice versa pythonpython program translate morseconvert characters in a string to morse code python0 1 morse code dict pythonmorse code dictionary in pythonmorse code to text pythonpython morse codeto morse code pythonmorse code bits pythonaudi morse code in pythonmorse code decipher pythonnumbers in morse code dictionary pythondecode morse in pythonmorse to words pythonpython morse code typermorse dictionary pythontranslate morse code pythonmorse code converter in pythonpunctuation in morse code pythonimplement interanational morse code using pyhtonabc and numbers to morse code pythonmorse code picture translatorpython code for translating morsepython morse code english to morse codemorse decoder pythonpython script to decode telegraph morse codemorse code translator python applicationpython translate text file to morse codedecode morse with pythonmorse code python codemorse to text python codehow to convert text to morse code with pythonc c3 b3digo morse pythonhow to make morse code translator in pythondecode the morse code pythonmorse code python librarypython dictionary for translating morsehow to morse code in pythonpython morse code librarydecode morse code to text pythonpython morse code generatorpython morse code 3fmorse code in pythondecode morse code pythondecode the morse code python solutionmorse code generator pythontext to morse cide pythonproject on morse code in pythonconvert morse code to text pythonpython interpret morse codemorse code machine in python translatorhow to convert letters to morse code pythonmorse code decoder pythommorse to english pythoncode translator in python 3write a program that asks the user to enter a string and then converts that string to morse codepython morse code encodermorse code to alphabet dictionaryhow to convert string to morse code pythontext to morse cide python librarymose decoder pythonwrite a function that returns the morse code sequence from a single letter pythonconvert string to morse code pythonpython text to morse and vice versahow to write a python program for a morse codepython morse dictmorse code translator pythonhow to decode morse code in pythonsimple morse code translator in pythonconvert text to morse code in pythontext to morse code pythonmorse code python devide with slashesmorse translator pythonmorse code encryptor and decrypt pythonhow to make a morse code translator in pythonhow to make a morse code translator in python