Created
October 25, 2017 17:01
-
-
Save yngwie74/3e9a36c6ece067f003ba9cdb7ff920d3 to your computer and use it in GitHub Desktop.
Cálculo del dígito verificador de la CLABE
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
#!/usr/bin/env python | |
from itertools import cycle, izip | |
def digver(clabe): | |
mult = cycle((3,7,1)) | |
cta = (int(c) for c in clabe) | |
res = ((a * b) % 10 for (a, b) in izip(mult, cta)) | |
return 10 - (sum(res) % 10) | |
banco = '014' | |
plaza = '180' | |
cuenta = 'xxxxxxx5528' | |
print banco, plaza, cuenta, digver(banco + plaza + cuenta) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment