Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Netherlands IBAN account number checksum validator
# 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
You can’t perform that action at this time.