Sunday afternoon Python: Morse code
... That is to say the code was written on a Sunday afternoon. The publish date of this post may vary. A lazy Sunday afternoon reading about Morse code made me hit upon the idea of a Python script that writes plain text into Morse code, and converts Morse code back to plain text. Some time spent mulling over the idea gave me a list of initial requirements: I would need to map plain text letters back to Morse code (and vice versa), let the user of the script choose between converting plain text into Morse code or vice versa, and take input from the user. Mapping text to Morse code with Python Data Structures Mapping the plain text letters of the alphabet to Morse code can really be thought of as a pair like relationship between two data sets. In Python, dictionaries are a type of data structure that store key/value pairs - perfect! The 'key' in this instance would be a letter of the alphabet and the 'value' of that key would be its corresponding Morse code. The o...