Python Forum

Full Version: How to fix bugs in Morse alphabet code?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Isn't it silly searching a dictionary? I like your idea of making a reverse dictionary. I would probably have separate encoder and decoder dictionaries, but as long as there is no overlap in the keys and values, you can put it all in one.

The encode and decode functions should be nearly identical other. Your decode function failed because you need to remove the trailing '///' before splitting the encoded string into codes.
Pages: 1 2