Last active
November 19, 2022 09:04
-
-
Save canerbasaran/6334104 to your computer and use it in GitHub Desktop.
Rastgele TC Kimlik No Üreticisi
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# Copyright 2011 Caner BASARAN | |
# Licensed under the GNU General Public License, version 2. | |
# See the file http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt | |
from random import randint | |
def rastgele_tc(): | |
tcno = str(randint(100000000, 1000000000)) | |
list_tc = map(int, tcno) | |
tc10 = (sum(list_tc[::2]) * 7 - sum(list_tc[1::2])) % 10 | |
return tcno + str(tc10) + str((sum(list_tc[:9]) + tc10) % 10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
merhaba,
13. satırı
list_tc = list(map(int, tcno))
olarak değiştirmek gerekiyor.