Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

See new calc rif #1

Open
EdwinBetanc0urt opened this issue Sep 28, 2024 · 0 comments
Open

See new calc rif #1

EdwinBetanc0urt opened this issue Sep 28, 2024 · 0 comments

Comments

@EdwinBetanc0urt
Copy link
Owner

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])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant