checkdigit.gs1.calculate

checkdigit.gs1.calculate(data: str) str[source]

Calculates GS1 Check Digit.

This method works for all fixed length numeric GS1 data structures (including GDTI, GLN, GRAI, etc.) that require a check digit.

Parameters:

data – A string of characters

Returns:

The check digit that was missing

Return type:

str

Examples

>>> from checkdigit import gs1
>>> gs1.calculate("00199999980000110")
'7'
>>> gs1.calculate("67368623738347505")
'1'