morse code to english python3
Once you define the mapping in one direction, you can use a dict comprehension to map it the other way CODE = {‘A’: ‘.-‘, ‘B’: ‘-…’, ‘C’: ‘-.-.’, ‘D’: ‘-..’, ‘E’: ‘.’, ‘F’: ‘..-.’, ‘G’: ‘–.’, ‘H’: ‘….’, ‘I’: ‘..’, ‘J’: ‘.—‘, ‘K’: ‘-.-‘, ‘L’: ‘.-..’, ‘M’: ‘–‘, ‘N’: ‘-.’, ‘O’: ‘—‘, ‘P’: ‘.–.’, ‘Q’: … Read more