checkdigit.isbn.calculate

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

Calculates ISBN Check Digits.

Parameters:

data – A string of characters representing an ISBN code without the check digit

Returns:

The check digit that was missing

Return type:

str

Examples

>>> from checkdigit import isbn
>>> # ISBN-10
>>> isbn.calculate("043942089")
'X'
>>> # ISBN-13
>>> isbn.calculate("978-1-86197-876")
'9'