Skip to content

Instantly share code, notes, and snippets.

@melihme
Last active June 16, 2022 10:49
Show Gist options
  • Save melihme/6ec023705d0afc213019 to your computer and use it in GitHub Desktop.
Save melihme/6ec023705d0afc213019 to your computer and use it in GitHub Desktop.
Vergi Kimlik No. Doğrulama (Python)
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