checkdigit.luhn.calculate

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

Calculates the luhn check digit.

Parameters:

data – A block of data without the check digit

Returns:

A string representing the missing check digit

Return type:

str

Examples

>>> from checkdigit import luhn
>>> luhn.calculate("53251309870224")
'3'
>>> luhn.calculate("950123440000")
'8'