Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- morse = {'.-': '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',
- '-----': '0', '.----': '1', '..---': '2', '...--': '3', '....-': '4', '.....': '5', '-....': '6',
- '--...': '7', '---..': '8', '----.': '9'}
- morse_text = input().split("|")
- new_text = ""
- for word in morse_text:
- word_list = word.split()
- new_word = ""
- for ch in word_list:
- letter = morse[ch]
- new_word += letter
- new_text += new_word + " "
- print(new_text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement