-
-
Save apalala/2848b682931bb4cd319b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def digito_rif(ci): | |
''' | |
toma un nro de cedula o rif y verifica el digito validador | |
''' | |
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) | |
print digit | |
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