DDigitTally
Product

Product features · ASCII Luhn validation

01

Keep leading zeros and test both parity lengths, rejecting spaces and non-ASCII digits without claiming account validity.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

ASCII Luhn validation

● ● ●DigitTally●
A concrete starting point · ASCII Luhn validation ×
def luhn_valid(text):
    if type(text) is not str or not 2 <= len(text) <= 64:
        raise ValueError("luhn.length")
    if any(char < "0" or char > "9" for char in text):
        raise ValueError("luhn.alphabet")
    total = 0
    for index, char in enumerate(reversed(text)):
        digit = ord(char) - ord("0")
        if index % 2:
            digit *= 2
            if digit > 9:
                digit -= 9
        total += digit
    return total % 10 == 0
✳ASCII Luhn validation
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗