checkdigit.gs1.missing

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

Calculates a missing digit in a GS1 Code.

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 representing a full ISBN code with a question mark representing a missing character

Returns:

The missing value that should’ve been where the question mark was

Return type:

str

Examples

>>> from checkdigit import gs1
>>> gs1.missing("?8945528")
'9'
>>> gs1.missing("992802?035392")
'2'
>>> gs1.missing("084085752492131?31")
'7'
>>> gs1.missing("846684302750007275")
'Invalid'