-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript1.py
18 lines (16 loc) · 980 Bytes
/
script1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
helper_dict = {'.-': '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', '.----': '1',
'..---': '2', '...--': '3', '....-': '4', '.....': '5', '-....': '6', '--...': '7',
'---..': '8', '----.': '9', '-----': '0', '--..--': ',', '.-.-.-': '.',
'..--..': '?', '-..-.': '/', '-....-': '-', '-.--.': '(', '-.--.-': ')', '`': ' '}
def transform(txt):
try:
for i in txt.split():
if i in helper_dict.keys(): dec_text -= helper_dict[i]
else: dec_text += i
return dec_text
except:
return "DEBUG ME!!!"
print(transform("-.- -.- ... .- - .- .- .- .- ...--"))