![]() |
Morse Decoder - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Python (https://sinister.ly/Forum-Python) +--- Thread: Morse Decoder (/Thread-Morse-Decoder) Pages:
1
2
|
Morse Decoder - Ex094 - 04-18-2013 ![]() This is a very simple python program that uses a dictionary containing Morse code key like '-' for T. The condition to decode via key present in the dictionary is: Code: store = '' Source Code: Code: morse = {'.-' : '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', '-----' : '0', '.----':'1','..---':'2','...--':'3','....-':'4','.....':'5','-....':'6','--...':'7','---..':'8','----.':'9',} Compiled Source Download: http://www.mediafire.com/?nujm7sgcxcliu97 Everything is explained in the code comments, Have fun! If you like, you can make it encode the normal text into a morse, you just need to reverse the dictionary values and then ask for normal text ![]() Morse Decoder - Ex094 - 04-18-2013 ![]() This is a very simple python program that uses a dictionary containing Morse code key like '-' for T. The condition to decode via key present in the dictionary is: Code: store = '' Source Code: Code: morse = {'.-' : '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', '-----' : '0', '.----':'1','..---':'2','...--':'3','....-':'4','.....':'5','-....':'6','--...':'7','---..':'8','----.':'9',} Compiled Source Download: http://www.mediafire.com/?nujm7sgcxcliu97 Everything is explained in the code comments, Have fun! If you like, you can make it encode the normal text into a morse, you just need to reverse the dictionary values and then ask for normal text ![]() RE: Morse Decoder - Deque - 04-18-2013 Well done, @"Ex094". I thought lately that we could make a multi encoder for HC that includes morse code as well. RE: Morse Decoder - Deque - 04-18-2013 Well done, @"Ex094". I thought lately that we could make a multi encoder for HC that includes morse code as well. RE: Morse Decoder - Psycho_Coder - 04-18-2013 Wow that looks good , I think I am going to make one in C++ or in VB.NET too . Seeing this I remembered Coder-sans contest in which we were given a morse code for decoding .. RE: Morse Decoder - Psycho_Coder - 04-18-2013 Wow that looks good , I think I am going to make one in C++ or in VB.NET too . Seeing this I remembered Coder-sans contest in which we were given a morse code for decoding .. RE: Morse Decoder - Anima Templi - 04-18-2013 Really great job! I like that you are still making tools in Python. And you did a very great job at explaining that code also. RE: Morse Decoder - Anima Templi - 04-18-2013 Really great job! I like that you are still making tools in Python. And you did a very great job at explaining that code also. RE: Morse Decoder - Coder-san - 04-18-2013 Nice. A job well done. RE: Morse Decoder - Coder-san - 04-18-2013 Nice. A job well done. |