Last active
November 23, 2016 11:13
-
-
Save Dreamersoul/a9c42188927190a053559eec5621a0a2 to your computer and use it in GitHub Desktop.
civil id validation
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
civil_id = "CIVIL ID HERE" # ex "2950980214009" | |
civil_id = map(int, civil_id) | |
multiples = [2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2] | |
summation = sum([a*b for a,b in zip(civil_id[:-1],multiples)]) # Multiply each number with its weight then sum them together | |
check = ((11-summation%11) == civil_id[11]) | |
print check |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment