Python implementation of simple Morse code translator

From , 2 Years ago, written in Python, viewed 96 times.
URL https://pastebin.vip/view/03227b95
  1. CODE = {'A': '.-',     'B': '-...',   'C': '-.-.',
  2.         'D': '-..',    'E': '.',      'F': '..-.',
  3.         'G': '--.',    'H': '....',   'I': '..',
  4.         'J': '.---',   'K': '-.-',    'L': '.-..',
  5.         'M': '--',     'N': '-.',     'O': '---',
  6.         'P': '.--.',   'Q': '--.-',   'R': '.-.',
  7.         'S': '...',    'T': '-',      'U': '..-',
  8.         'V': '...-',   'W': '.--',    'X': '-..-',
  9.         'Y': '-.--',   'Z': '--..',
  10.        
  11.         '0': '-----',  '1': '.----',  '2': '..---',
  12.         '3': '...--',  '4': '....-',  '5': '.....',
  13.         '6': '-....',  '7': '--...',  '8': '---..',
  14.         '9': '----.'
  15.         }
  16.  
  17.  
  18. def main():
  19.        
  20.         msg = raw_input('MESSAGE: ')
  21.        
  22.         for char in msg:
  23.                 if char == ' ':
  24.                         print
  25.                 else:
  26.                         print CODE[char.upper()] + '  ',
  27.                
  28. if __name__ == "__main__":
  29.         main()
  30.  
  31. #//python/6387

Reply to "Python implementation of simple Morse code translator"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website