Python SolutionsPython Solutions

⚙️

ABCD Message

Week 21, 2026

All Solutions

Python - Split, Convert and Print | BMC | Python Solutions

def msgToSetBits(msg: str, bitLen: int, rev: bool) -> list[str]: solve = [] if rev: msg = msg[::-1] for i in range(0, len(msg), bitLen): solve.append(msg[i:i + bitLen]) return solve def bitsToPackedBCD(msg: list[str]) -> str: result = "" for subBits in msg: val = int(subBits, 2) result += "." if val == 15 else str(val) return result # main msg = "0011111100010100000101011001001001100101001101011000100101111001001100100011100001000110001001100100001100111000001100100111100101010000001010001000010000011001011100010110100100111001100100110111010100010000010110000010000010010111010010010100010001011001001000110000011110000001011001000000011000101000011000100000100010011001100001100010100000000011010010000010010100110100001000010001011100000110011110011000001000010100100000001000011001010001001100101000001000110000011001100100011100001001001110000100010001100000100101010101000001011000001000100011000101110010010100110101100101000000100000010010100001001000000100010001011101000101000000101000010000010000001001110000000110010011100001010010000100010000010101010101100101100100010001100010001010010100100010010101010010010011000000111000000110010110010001000010100010000001000010010111010101100110010110010011001101000100011000010010100001000111010101100100100000100011001101111000011001111000001100010110010100100111000100100000000110010000100100010100010101100100100001010110011010010010001101000110000000110100100001100001000001000101010000110010011001100100100000100001001100111001001101100000011100100110000000100100100100010100000100100111001101110010010001011000011100000000011001100000011000110001010101011000100000010111010010001000000101010010000010010010000010010110001010000010100100100101010000001001000101110001010100110110010000110110011110001001001001011001000000110110000000000001000100110011000001010011000001010100100010000010000001000110011001010010000100111000010000010100011010010101000110010100000101010001000101100000100101000011001100000101011100100111000000110110010101110101100101011001000110010101001100001001001000011000011000010001011100111000000110010011001001100001000101111001001100010000010100010001100001010100100000000111010001000110001000110111100110010110001001110100100101010110011100110101000110001000010101110101001001110010010010001001000100100010011110010011100000011000001100000001000110010100100100010010100110000011001101100111001100110110001001000100000001100101011001100100001100001000011000000010000100111001010010010100011000111001010100100010010001110011011100011001000001110000001000010111100110000110000010010100001101110000001001110111000001010011100100100001011100010111011000101001001100010111011001110101001000111000010001100111010010000001100001000110011101100110100101000000010100010011001000000000000001010110100000010010011100010100010100100110001101010110000010000010011101111000010101110111000100110100001001110101011101111000100101100000100100010111001101100011011100010111100001110010000101000110100001000100000010010000000100100010010010010101001101000011000000010100011001010100100101011000010100110111000100000101000001111001001000100111100101101000100100100101100010010010001101010100001000000001100110010101011000010001001000010010100100000010000110010110000010000110010000000011010001000001100000010101100110000001001101100010100101110111010001110111000100110000100110010110000001010001100001110000011100100001000100110100100110011001100110011001100000110111001010010111100000000100100110010101000100000101100101110011000101110011001010000001011000001001011000110001100001011001010100000010010001000101100101000101010100110100011010010000100000110000001001100100001001010010001000110000100000100101001100110100010001101000010100000011010100100110000110010011000100011000100000010111000100000001000000000000001100010011011110000011100001110101001010001000011001011000011101010011001100100000100000111000000101000010000001100001011100010111011101100110100100010100011100110000001101011001100000100101001101001001000001000010100001110101010101000110100001110011000100010101100101010110001010000110001110001000001000110101001101111000011101011001001101110101000110010101011101111000000110000101011101111000000001010011001000010111000100100010011010000000011001100001001100000000000110010010011110000111011001100001000100011001010110010000100100100001011001000010000000011001" ans = bitsToPackedBCD(msgToSetBits(msg, 4, False)) print(ans)