Untitled
unknown
plain_text
3 years ago
625 B
5
Indexable
messageBits = input("Enter the binary bits of the message:") inverseBits = messageBits[::-1] m = len(messageBits) r = 0 while(2**r < m + r + 1): r = r + 1 l = [] positions = [2**i for i in range(r)] index = 0 for x in range(1, r + m + 1): if(x in positions): l.insert(x, "r"+str(x)) else: l.insert(x, int(inverseBits[index])) index = index + 1 print(l) def calculate(x): count = 0 while(x != len(l) + 1): for(i in range(x)): if(l[x] == 1): count = count + 1 x = x + 1 for x in positions:
Editor is loading...