Skip to content

Instantly share code, notes, and snippets.

@irfantogluk
Last active November 14, 2018 14:14
Show Gist options
  • Save irfantogluk/8a27b4f8af77fc7c7c0d2bd4f920585a to your computer and use it in GitHub Desktop.
Save irfantogluk/8a27b4f8af77fc7c7c0d2bd4f920585a to your computer and use it in GitHub Desktop.
İlk 9 basamağı girilen T.C. kimlik numarasının son iki basamağını bulan program kodudur. tc(123456789) şeklinde çalışır.
digits=lambda x:[int(d) for d in str(x)];on=lambda x:str(x)+str((((7*sum(digits(x)[:9][-1::-2]))-sum(digits(x)[:9][-2::-2]))%10));tc=lambda x:int(on(x)+str(sum(digits(on(x))[:10]) % 10))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment