4 ms·
The bug is that bin(decimal)[2:] should be bin(decimal)[2:].rjust(8, '0') or else the leading zeros are not counted. Personally I would probably ha
by jeltz 7y ago
The bug is that
bin(decimal)[2:]
should be
bin(decimal)[2:].rjust(8, '0')
or else the leading zeros are not counted.
Personally I would probably have used shift for a simple script like this.
- joezydeco 7y agoOr a 255-entry precomputed lookup table.