Dots and Dashes
Description
Analysis
Solution
from textwrap import wrap
enc = '''
-..---.--..---..-..----.-..---..-...-.---..--..--....-..-..-...---..-----.-.-.---.-.....-.-.---.-.-.-.-.--.----.-...-.----..--..-.-.....-.--..-.--..-----...--.---..-.-.-.---.-.-.-.....--...--.--...-----..---.--..-.----..-.-.--..-.---.....-.
'''.strip() # Remove trailing spaces
enc = enc.replace("-", "0").replace(".", "1") # Replace chars with binary values
for byte in wrap(enc, 8): # 8bit -> 1byte
# str -> int (base 2) -> chr
print(chr(int(byte, 2)), end='')Last updated