For this challenge we are investigating how barcodes are produced. Though there are different standards to produce barcodes, they all follow a similar approach based on binary code!
Did you know?
On a barcode the pattern made using black and white lines is in fact binary code! A black line represents a 1 and a white line a 0.
So the following binary code “0101” consists of a thin white line, a thin black line, a thin white line and a thin black line.
The following binary code “1110” however consists of a large black line (as thick as 3 lines) and a thin white line.
So to produce our own simplified bar codes all we need to know is convert each digit of the actual number into binary (using 4 digit binary codes, aka a nibble)
Using Python to generate random barcodes
Adapt this script to ask the end-user to enter their initials. Use the ASCII table to convert these initials into ASCII and then into binary code to then generate a barcode matching those initials.