Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

I’m building a Morse code encoder/decoder in Python and ran into an issue when decoding messages that contain multiple spaces or unsupported symbols.
The decoder works fine for simple inputs like:
… . .-… .-… —
which correctly outputs: HELLO
But when the input contains word separators or unexpected characters, the output becomes inconsistent.
Example problematic input: … . .-… .-… — .-- — .-. .-… -… @
Expected output: HELLO WORLD
Actual behavior:
@ break the parserKeyError exceptionsCurrent decoding logic:
MORSE_CODE_DICT = { ‘.-’: ‘A’, ‘-…’: ‘B’, # … }
decoded = “”
for code in morse_input.split(" "): decoded += MORSE_CODE_DICT[code]
Questions:
What’s the best way to safely handle invalid Morse sequences? How should multiple spaces be interpreted when separating words? Is there a more robust parsing strategy for Morse code decoding in Python?
Any suggestions or best practices would be appreciated.
b76b4218c0eb414e8c679429f956d7
1d69cdb0090446a3b6596843b055eb
Edwin
f25932a0b984430fb48c4256f1aaad
Bobby
33c069bd261048daa765d31692cba6
TheGarkine
Mor Sagmon
Wolf Bishop
coolusaHD
Gabriel P
BigElectricBlueWalrus