2 ms·
The reason you're measuring more 1's than 0's is this line: binary = bin(decimal)[2:] That's because while `bin(0xff)` is indeed "0b11111111", `bin(0x00)` i
by oconnor663 7y ago
The reason you're measuring more 1's than 0's is this line:
binary = bin(decimal)[2:]
That's because while `bin(0xff)` is indeed "0b11111111", `bin(0x00)` is "0b0". Python omits your leading zeros.
A smaller nit, these lines:
hexadecimal = binascii.hexlify(byte)
decimal = int(hexadecimal, 16)
can be just
decimal = byte[0]
- edent 7y agoD'oh! I swear I had a `.zfill(8)` in there. Looks like the whole thing is wrong. Oh well!