Skip to content

Instantly share code, notes, and snippets.

@ik5
Created Sep 7, 2020
Embed
What would you like to do?
calc israeli id number for valid last number in python 2
#!/usr/bin/env python2
def validate_id_number(id_num):
anID = id_num.zfill(9)
return sum(
sum(
map(
int, str(int(a)*(i % 2 + 1))
)
) for i, a in enumerate(anID)) % 10 == 0
if __name__ == '__main__':
print(validate_id_number('123456782'))
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment