SHARE
TWEET

morse

a guest Apr 29th, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. morse = '..-. ..- -.-. -.- .. -. --. / -. --- .-. -- .. . ... / --. . - / --- ..-. ..-. / -- -.-- / ... - .-. . .- --'
  2.  
  3. converter = {'.-': 'A', '-...': 'B', '-.-.': 'C', '-..': 'D', '.': 'E', '..-.': 'F', '--.': 'G', '....': 'H', '..': 'I', '.---': 'J', '-.-': 'K', '.-..': 'L', '--': 'M', '-.': 'N', '---': 'O', '.--.': 'P', '--.-': 'Q', '.-.': 'R', '...': 'S', '-': 'T', '..-': 'U', '...-': 'V', '.--': 'W', '-..-': 'X', '-.--': 'Y', '--..': 'Z'}
  4.  
  5. result = ''.join([converter.get(code, ' ') for code in morse.split(' ')])
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top