{ ggrrrrrrrrhhhhh }

The following code snippet can be used for validating the checksum on a ABA routing number.

def valid_routing_number(routing_number: str):
    if len(routing_number) != 9:
        return False

    if not routing_number.isnumeric():
        return False

    checksum = (3 * (int(routing_number[0]) + int(routing_number[3]) + int(routing_number[6]))) + \
               (7 * (int(routing_number[1]) + int(routing_number[4]) + int(routing_number[7]))) + \
               (1 * (int(routing_number[2]) + int(routing_number[5]) + int(routing_number[8])))

    return (checksum % 10) == 0

Ramon Torres - iOS developer/product designer

My name is Ramon Torres. I'm a software developer and product designer, currently working at Gooroo Tutors building cool stuff.