Skip to content

See new calc rif #1

@EdwinBetanc0urt

Description

@EdwinBetanc0urt

https://groups.google.com/g/python-venezuela/c/DQSta7qOc2k

def digito_rif(ci):
    '''
    toma un nro de cedula o rif y verifica el digito validador
    ej.  V12345678 ó J12345678

    '''
    base = {'V': 1 * 4, 'E': 2 * 4, 'J': 3 * 4}
    oper = [0, 3, 2, 7, 6, 5, 4, 3, 2]
    for i in range(len(ci[:9])):
        if i == 0:
            val = base.get(ci[0], 0)
        else:
            val += oper[i] * int(ci[i])
    digit = 11 - (val % 11)
    return '%s%s' % (ci[:9], str(digit)[-1])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions