MCPcopy Create free account
hub / github.com/WhyNotHugo/python-barcode / calculate_checksum

Method calculate_checksum

barcode/codex.py:118–124  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

116 return f"PZN-{self.pzn}"
117
118 def calculate_checksum(self):
119 sum_ = sum(int(x) * int(y) for x, y in enumerate(self.pzn, start=2))
120 checksum = sum_ % 11
121 if checksum == 10:
122 raise BarcodeError("Checksum can not be 10 for PZN.")
123
124 return checksum
125
126
127class PZN8(PZN7):

Calls 1

BarcodeErrorClass · 0.90