checkdigit.luhn.missing¶
- checkdigit.luhn.missing(data: str) str [source]¶
Calculates a missing digit in a luhn code.
- Parameters:
data – A string of characters representing a full luhn code with a question mark for a missing character
- Returns:
The missing value that should’ve been where the question mark was
- Return type:
str
Examples
>>> from checkdigit import luhn >>> luhn.missing("54175611658527?") '7' >>> luhn.missing("515853022?76176") '1' >>> luhn.missing("78369216316") 'Invalid'