I need to change a zip code into a series of dots and dashes (a barcode), but I can't figure out how
- by Maggie
Here's what I've got so far:
def encodeFive(zip):
zero =  "||:::"
one =   ":::||"
two =   "::|:|"
three = "::||:"
four =  ":|::|"
five =  ":|:|:"
six =   ":||::"
seven = "|:::|"
eight = "|::|:"
nine =  "|:|::"
codeList = [zero,one,two,three,four,five,six,seven,eight,nine]
allCodes = zero+one+two+three+four+five+six+seven+eight+nine
code = ""
digits = str(zip)
for i in digits:
    code = code + i    
return code
With this I'll get the original zip code in a string, but none of the numbers are encoded into the barcode. I've figured out how to encode one number, but it wont work the same way with five numbers.