We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 13538c8 commit daf138bCopy full SHA for daf138b
1 file changed
barcode/ean.py
@@ -84,9 +84,10 @@ def calculate_checksum(self):
84
85
def sum_(x, y):
86
return int(x) + int(y)
87
-
88
- evensum = reduce(sum_, self.ean[-2::-2])
89
- oddsum = reduce(sum_, self.ean[-1::-2])
+ ean_without_checksum = self.ean[:self.digits]
+
+ evensum = reduce(sum_, ean_without_checksum[-2::-2])
90
+ oddsum = reduce(sum_, ean_without_checksum[-1::-2])
91
return (10 - ((evensum + oddsum * 3) % 10)) % 10
92
93
def build(self):
0 commit comments