Last active
June 16, 2022 10:49
-
-
Save melihme/6ec023705d0afc213019 to your computer and use it in GitHub Desktop.
Vergi Kimlik No. Doğrulama (Python)
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
def taxnum_checker(t): | |
if len(t) != 10: | |
return False | |
total = 0 | |
for x in xrange(0, 9): | |
tmp1 = (int(t[x]) + (9 - x)) % 10 | |
tmp2 = (tmp1 * (2 ** (9 - x))) % 9 | |
if tmp1 != 0 and tmp2 == 0: | |
tmp2 = 9 | |
total += tmp2 | |
if total % 10 == 0: | |
check_num = 0 | |
else: | |
check_num = 10 - (total % 10) | |
return int(t[9]) == check_num |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment