Netherlands IBAN account number checksum validator
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
# Netherlands account number algorithm uses this factor table: | |
# digit | factor | |
# 1st | 10 | |
# 2nd | 9 | |
# ... | |
# 10th | 1 | |
# | |
# After multiplying digits according to the table, sum of these results must be divisible with 11 | |
def validate(acc): | |
f = 10 | |
total = 0 | |
for a in acc: | |
total += int(a) * f | |
f -= 1 | |
return total % 11 == 0 | |
validate("1834239443") # True | |
validate("1234567890") # False | |
# Use schwifty module for IBAN validation, however, | |
# it does not support Netherlands account number validation, | |
# so validate it seperately with this function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment